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

fix to run on TF2.4 #173

Open
albertnew2012 opened this issue Nov 16, 2021 · 6 comments
Open

fix to run on TF2.4 #173

albertnew2012 opened this issue Nov 16, 2021 · 6 comments

Comments

@albertnew2012
Copy link

I don't understand why the code wouldn't run on TF2.4, but I found the reason causing the failure. Taking detection_demo.py as an example, detect_video, detect_realtime and detect_screen all fail, but one just needs to make a tiny change in utils.py:

        if YOLO_FRAMEWORK == "tf":
            pred_bbox = yolo.predict(image_data)

by changing yolo.predict->yolo, then it works like a charm again.
I looked up online, it seems there is no difference between model.predict() and model(), but anyhow it fails the code in TF2.4.

Happy learning,
Cheers

@yugkhanna
Copy link

@ZhengzhiLiu are you able to reproduce the same results in terms of speed on your machine? If yes, can you tell me how fast the detect_video is running and what GPU you are using? I am unable to reproduce the quoted results in terms of fps using pretrained yolov4/yolov3 model files

@albertnew2012
Copy link
Author

albertnew2012 commented Nov 17, 2021

@yugkhanna I was able to reproduce the reported about 20 FPS in the code README.md on both TF2.3 and TF2.4. In order to run the code on TF2.4, you may need to make the changes as I mentioned above. On TF2.4 detect_video runs at 20 FPS on my RTX3080 (only support TF2.4 and above for GPU version)
Screenshot from 2021-11-17 13-53-20
.
Screenshot from 2021-11-17 14-05-48

YOLO tiny is able to run at 55 FPS, but the result is bad, bbox is too small and does not cover the entire object, and sometimes a single object has multiple bboxes, it seems nms failed.
Screenshot from 2021-11-17 14-37-35

@Crytap
Copy link

Crytap commented Nov 18, 2021

@ZhengzhiLiu I also noticed like @yugkhanna that with this fix at detect_video the fps are lower than before.
I have tested with detection_demo and the test.mp4 file.

In comparison (Python 3.7, TF 2.3, GPU: 980ti):
yolo.predict(image_data) i get ~16fps
yolo(image_data) i get ~8fps

Do you have any idea what could be the reason for this?

I also noticed at TF >= 2.4 that when printing pred_bbox in detect_video with yolo.predict(image_data), the bounding boxes contain correct values in the first frame and then consist only of nan.

@JuliusJacobitz
Copy link

I also noticed at TF >= 2.4 that when printing pred_bbox in detect_video with yolo.predict(image_data), the bounding boxes contain correct values in the first frame and then consist only of nan.

@Crytap I'm currently struggling with exactly this problem. Do you have any advice which tf version to use?

@Crytap
Copy link

Crytap commented Nov 24, 2021

@JuliusJacobitz With TF 2.3 everything works without any problems.

@EVNN304
Copy link

EVNN304 commented Dec 9, 2021

@ZhengzhiLiu Hello. What other changes have you made to increase the frame rate to 21?

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

5 participants