Skip to content

Commit

Permalink
Remove JSON and IMG files after processing
Browse files Browse the repository at this point in the history
  • Loading branch information
abagshaw committed May 22, 2017
1 parent f235bee commit d7035de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/test_darkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def test_CLI_IMG_YOLOv2():

outputImgPath = os.path.join(os.path.dirname(testImg["path"]), "out", os.path.basename(testImg["path"]))
assert os.path.exists(outputImgPath), "Expected output image: {0} was not found.".format(outputImgPath)
os.remove(outputImgPath) #Remove the image so that it does not affect subsequent tests

def test_CLI_JSON_YOLOv2():
#Test predictions outputted to a JSON file using the YOLOv2 model through CLI
Expand All @@ -143,6 +144,7 @@ def test_CLI_JSON_YOLOv2():
loadedPredictions = json.load(json_file)

assert compareObjectData(testImg["expected-objects"]["yolo"], loadedPredictions, testImg["width"], testImg["height"], threshCompareThreshold, posCompareThreshold), "Generated object predictions from JSON were not within margin of error compared to expected values."
os.remove(outputJSONPath) #Remove the JSON file so that it does not affect subsequent tests

def test_CLI_JSON_YOLOv1():
#Test predictions outputted to a JSON file using the YOLOv1 model through CLI
Expand All @@ -159,6 +161,7 @@ def test_CLI_JSON_YOLOv1():
loadedPredictions = json.load(json_file)

assert compareObjectData(testImg["expected-objects"]["yolo-small"], loadedPredictions, testImg["width"], testImg["height"], threshCompareThreshold, posCompareThreshold), "Generated object predictions from JSON were not within margin of error compared to expected values."
os.remove(outputJSONPath) #Remove the JSON file so that it does not affect subsequent tests

def test_CLI_SAVEPB_YOLOv2():
#Save .pb and .meta as generated from the YOLOv2 model through CLI
Expand Down Expand Up @@ -214,4 +217,4 @@ def test_TRAIN_FROM_WEIGHTS_CLI__LOAD_CHECKPOINT_RETURNPREDICT_YOLOv2():
assert compareObjectData(trainImgHorsePerson["expected-objects"]["tiny-yolo-voc"], loadedPredictions, trainImgHorsePerson["width"], trainImgHorsePerson["height"], 0.7, 0.25), "Generated object predictions from training (for image with person on the horse) were not anywhere close to what they are expected to be.\nTraining may not have completed successfully."
differentThanExpectedHorse = compareObjectData(trainImgHorsePerson["expected-objects"]["tiny-yolo-voc"], loadedPredictions, trainImgHorsePerson["width"], trainImgHorsePerson["height"], 0.01, 0.001)

assert not (differentThanExpectedBike and differentThanExpectedHorse), "The generated object predictions for both images appear to be exactly the same as the ones generated with the original weights.\nTraining may not have completed successfully.\n\nNOTE: It is possible this is a fluke error and training did complete properly (try running this build again to confirm) - but most likely something is wrong."
assert not (differentThanExpectedBike and differentThanExpectedHorse), "The generated object predictions for both images appear to be exactly the same as the ones generated with the original weights.\nTraining may not have completed successfully.\n\nNOTE: It is possible this is a fluke error and training did complete properly (try running this build again to confirm) - but most likely something is wrong."

0 comments on commit d7035de

Please sign in to comment.