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

Model json file parsing error #15

Closed
yoo-jimin127 opened this issue Jun 29, 2022 · 4 comments
Closed

Model json file parsing error #15

yoo-jimin127 opened this issue Jun 29, 2022 · 4 comments

Comments

@yoo-jimin127
Copy link

yoo-jimin127 commented Jun 29, 2022

Hello!
I found an error in parsing the /web_model/model.json file.
I referred to Issue #9 and #7 to find a solution, but the error was not resolved.
May I get some advice?
image

@zldrobit
Copy link
Owner

@yoo-jimin127 Of course. Plz share more information to debug the error:

  • Have you changed the code in the repo?
  • Did you link yolov5s_web_model to web_model, i.e. ln -s ../../yolov5/yolov5s_web_model public/web_model?
  • Plz provide the output message from terminal after the command npm start?
  • Press F12 in the browser to show the debug window and share the full debug stack.
  • Run curl http://localhost:3000/web_model/model.json and curl http://localhost:3000/tfjs-yolov5-example/web_model/model.json on terminal, and share the output messages in terminal.

@yoo-jimin127
Copy link
Author

Thank you very much for providing a detailed solution :)
Thanks to your advice, I was able to solve the problem.

I don't know exactly why, but ln -s../yolov5/yolov5s_web_modelpublic/web_model didn't work in my local environment.
Therefore, the problem was solved by replacing it with cp-r ../yolov5/yolov5s_web_model public/web_model.

Additionally, I am looking for a way to implement the function of changing the parameters of the yolov5 model in tf.js.
At https://github.com/ultralytics/yolov5,
It says that you can enter the yaml file and batch size in the following way for training.

python train.py --data coco.yaml --cfg yolov5n.yaml --weights '' --batch-size 128
                                       yolov5s                                64
                                       yolov5m                                40
                                       yolov5l                                24
                                       yolov5x                                16

In this code, Is there a way to train the model with the entered parameter value?

@zldrobit
Copy link
Owner

@yoo-jimin127 Yes, you could train whatever yolov5 model you like, e.g. yolov5s/m/l/x. After training, you could export the yolov5s/m/l/x model to tfjs format. Then, cp/ln -s the exported model path to the web_model path, e.g. tfjs-yolov5-example/public/web_model. Finally, run npm start as usual. Beware that yolov5m/l/x is slower than yolov5s on the browser.

@yoo-jimin127
Copy link
Author

@zldrobit Thank you very much.
This repo is really useful for my project development.
Thank you for providing good data :)

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

2 participants