thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

how to predict multiple images ? #1109

Closed Chaideo closed 4 years ago

Chaideo commented 4 years ago

should i use this method for every image or is there anything else that can be apply?

import pprint as pp

original_img = cv2.imread("/content/drive/any-image.jpg") original_img = cv2.cvtColor(original_img, cv2.COLOR_BGR2RGB) results = tfnet2.return_predict(original_img) print(results)

GoyalAnkit16 commented 4 years ago

Use following command - python flow --imgdir sample_img/ --model cfg/tiny-yolo.cfg --load bin/tiny-yolo.weights --gpu 1.0

This will run prediction on all the images contained in sample_img folder. All input images from folder sample_img/ are flowed through the net and predictions are put in sample_img/out/

bothe commented 4 years ago

@Chaideo yes, that should work please check similar predict function I am trying to contribute at https://github.com/bothe/darkflow (predict.py file, be particular to adding your configuration in config_options.py). The problem I am facing though is in the return_predict() function is not producing the same results as predict() function does.

Let me know if you have came across this issue and perhaps solved, I am trying from my side.