Skip to content

Commit

Permalink
Update tests on custom object detection to make sence with the chance…
Browse files Browse the repository at this point in the history
… introduced previously
  • Loading branch information
Rodrigo Laguna committed Aug 29, 2019
1 parent 7d66696 commit 56b79ad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/test_custom_object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

image_input = os.path.join(main_folder, "data-images", "14.jpg")
image_output = os.path.join(main_folder, "data-temp", "14-detected.jpg")
objects_output = os.path.join(main_folder, "data-temp", "14-detected-objects")
model_path = os.path.join(main_folder, "data-models", "hololens-ex-60--loss-2.76.h5")
model_json = os.path.join(main_folder, "data-json", "detection_config.json")

Expand All @@ -33,7 +34,8 @@ def test_object_detection_yolov3(clear_keras_session):
detector.setModelPath(model_path)
detector.setJsonPath(model_json)
detector.loadModel()
results = detector.detectObjectsFromImage(input_image=image_input, output_image_path=image_output, minimum_percentage_probability=40)
results = detector.detectObjectsFromImage(input_image=image_input, output_image_path=image_output,
minimum_percentage_probability=40)

assert isinstance(results, list)
for result in results:
Expand All @@ -49,7 +51,8 @@ def test_object_detection_yolov3(clear_keras_session):

assert isinstance(results2, list)
assert isinstance(extracted_paths, list)
assert os.path.isdir(os.path.join(image_output + "-objects"))
assert os.path.isdir(objects_output)
assert len(os.listdir(objects_output)) == len(results2)
for result2 in results2:
assert isinstance(result2["name"], str)
assert isinstance(result2["percentage_probability"], float)
Expand Down

0 comments on commit 56b79ad

Please sign in to comment.