Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. # loop over the input image paths
  2. for (i, imagePath) in enumerate(imagePaths):
  3.  
  4. print ("[INFO] predicting on image {} of {}".format(i+1, len(imagePaths)))
  5.  
  6. # Create the filename to store the predictions in and then open it in write mode
  7. filename = (imagePath.split(os.path.sep)[-1]).split('.')[0]
  8. output_file = os.path.sep.join([args["output"], '{}.txt'.format(filename)])
  9. file = open(output_file, 'w')
  10.  
  11. #load the input image (BGR), clone it, and preprocess it
  12. image = read_image_bgr(imagePath)
  13. image = preprocess_image(image)
  14. (image, scale) = resize_image(image)
  15. image = np.expand_dims(image, axis=0)
  16.  
  17. # detect objects in the input image and correct for the image scale
  18. (boxes, scores, labels) = model.predict_on_batch(image)
  19. boxes /= scale
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement