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

Class TestKerasCV

tests/test_keras_cv.py:9–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7from utils.kagglehub import create_test_kagglehub_server
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

no outgoing calls

Tested by

no test coverage detected