(self)
| 8 | |
| 9 | class TestKerasCV(unittest.TestCase): |
| 10 | def test_inference(self): |
| 11 | with create_test_kagglehub_server(): |
| 12 | classifier = keras_cv.models.ImageClassifier.from_preset( |
| 13 | 'efficientnetv2_b0_imagenet_classifier', |
| 14 | load_weights=False, # load randomly initialized model from preset architecture with weights |
| 15 | ) |
| 16 | image = keras.utils.load_img('/input/tests/data/face.jpg') |
| 17 | image = np.array(image) |
| 18 | predictions = classifier.predict(np.expand_dims(image, axis=0)) |
| 19 | top_classes = predictions[0].argsort(axis=-1) |
| 20 | self.assertEqual(1000, len(top_classes)) |
nothing calls this directly
no test coverage detected