MCPcopy Create free account
hub / github.com/Kaggle/docker-python / test_inference

Method test_inference

tests/test_keras_cv.py:10–20  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8
9class 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))

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected