Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # loop over the input image paths
- for (i, imagePath) in enumerate(imagePaths):
- print ("[INFO] predicting on image {} of {}".format(i+1, len(imagePaths)))
- # Create the filename to store the predictions in and then open it in write mode
- filename = (imagePath.split(os.path.sep)[-1]).split('.')[0]
- output_file = os.path.sep.join([args["output"], '{}.txt'.format(filename)])
- file = open(output_file, 'w')
- #load the input image (BGR), clone it, and preprocess it
- image = read_image_bgr(imagePath)
- image = preprocess_image(image)
- (image, scale) = resize_image(image)
- image = np.expand_dims(image, axis=0)
- # detect objects in the input image and correct for the image scale
- (boxes, scores, labels) = model.predict_on_batch(image)
- boxes /= scale
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement