Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trained model converted for inference/testing #21

Closed
wiamadaya opened this issue Jul 8, 2019 · 6 comments
Closed

trained model converted for inference/testing #21

wiamadaya opened this issue Jul 8, 2019 · 6 comments

Comments

@wiamadaya
Copy link

wiamadaya commented Jul 8, 2019

i converted both models the results from train.py and train_iou.py using convert_model.py, and use those models to perform inference/testing using this notebook from keras-retinanet https://github.com/delftrobotics/keras-retinanet/blob/master/examples/ResNet50RetinaNet.ipynb

Modified the imports accordingly from object_detector_retinanet.keras_retinanet and run the inference/testing

inference/testing using model converted from train.py went successfully, but inference/testing using model converted from train_iou.py i received the following error

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-5-c86318e1b643> in <module>
12 # process image
13 start = time.time()
---> 14 boxes, scores, labels = model.predict_on_batch(np.expand_dims(image, axis=0))
15 print("processing time: ", time.time() - start)
16

ValueError: too many values to unpack (expected 3)

@yfe404
Copy link
Contributor

yfe404 commented Jul 8, 2019

This is because the model with iou outputs one more element, try this:

boxes, hard_scores, labels, soft_scores = model.predict_on_batch(np.expand_dims(image, axis=0))

@wiamadaya
Copy link
Author

@yafeunteun thank you, i have made the modification on the for-loop as well, now it's working, but i'm still unsure whether the inference pipeline is correct, i mean how to properly utilize hard_scores and soft_scores on the prediction

@yfe404
Copy link
Contributor

yfe404 commented Jul 8, 2019

Here is a (quick and dirty) example that takes an image and plot bounding box detections as well as labels (tested with a single class):

https://github.com/yafeunteun/SKU110K_code/blob/master/examples/retinanet.ipynb
The first image is fed to retinanet, the second to the retinanet + iou merger aka the complete pipeline presented in the paper.

Here I've set the hard_score_rate argument to .3, from what I understand (I may be wrong, please double check), that means that the model will set the confidence that a box contains an object to .3hard_score + .7soft_score (both hard_score and soft_score are output by the model for each bounding box detected).

@wiamadaya
Copy link
Author

@yafeunteun thanks for being so helpful

@Pari-singh
Copy link

The weights shared at #9 outputs only 3 elements. Wanted to confirm if hard and soft scores are merged in that?

@eg4000
Copy link
Owner

eg4000 commented Aug 4, 2019

#30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants