MCPcopy
hub / github.com/Hironsan/BossSensor / predict

Method predict

boss_train.py:153–166  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

151 self.model = load_model(file_path)
152
153 def predict(self, image):
154 if K.image_dim_ordering() == 'th' and image.shape != (1, 3, IMAGE_SIZE, IMAGE_SIZE):
155 image = resize_with_pad(image)
156 image = image.reshape((1, 3, IMAGE_SIZE, IMAGE_SIZE))
157 elif K.image_dim_ordering() == 'tf' and image.shape != (1, IMAGE_SIZE, IMAGE_SIZE, 3):
158 image = resize_with_pad(image)
159 image = image.reshape((1, IMAGE_SIZE, IMAGE_SIZE, 3))
160 image = image.astype('float32')
161 image /= 255
162 result = self.model.predict_proba(image)
163 print(result)
164 result = self.model.predict_classes(image)
165
166 return result[0]
167
168 def evaluate(self, dataset):
169 score = self.model.evaluate(dataset.X_test, dataset.Y_test, verbose=0)

Callers 1

camera_reader.pyFile · 0.80

Calls 1

resize_with_padFunction · 0.90

Tested by

no test coverage detected