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

What changes to make to run in using our own yolov5 moels? #5

Closed
joel5638 opened this issue Jul 15, 2022 · 10 comments
Closed

What changes to make to run in using our own yolov5 moels? #5

joel5638 opened this issue Jul 15, 2022 · 10 comments

Comments

@joel5638
Copy link

Do we have to change the deepsort checkpoint?
We can replace the yolov5s.pt with our custom model. But what else changes do we have to make?

@SahilChachra
Copy link
Owner

SahilChachra commented Jul 15, 2022

For DeepSort checkpoint file
The path for checkpoint is - deep_sort_pytorch/deep_sort/deep/checkpoint
Refer to this to know to train and use your DeepSort weight file - https://github.com/nwojke/deep_sort

For Yolov5s weight file
In app.py,
I am passing model path in line number 92, 162 and 226 for local video, webcam and RTSP source respectively.
It looks like this detect(weights="yolov5s.pt", ...

To use your own model,
Copy the model to the Video-Analytics-Dashboard folder and update the model name.
For example, if your model name -> yolov5_custom.pt
then modify weights variable

detect(weights="yolov5_custom.pt", ...

@joel5638
Copy link
Author

Do I need to replace both the deepsort checkpoint and the custom yolov5s.pt file to check results of my custom model?
I already have my own custom yolov5 model. Do i need to train a deepsort to create my own chckpt again?

@SahilChachra
Copy link
Owner

First try replacing with your Yolov5 weight file. Most probably it'll get the job done.

If, after passing your own Yolov5 weight file, you don't see tracking then I think you will have to see how to train and work with DeepSort checkpoint file.

But I think, just by replacing with your Yolov5 file, it will work without any issues.

@joel5638
Copy link
Author

Great! One last question. Can we deploy this on AWS and use it there? If yes, do you have any tutorials or any steps?

@SahilChachra
Copy link
Owner

SahilChachra commented Jul 15, 2022

If you are thinking to deploy this Streamlit app to AWS, then

  1. Create an EC2 instance with GPU and drivers installed (Probably Ubuntu EC2 instance with Tensorflow/PyTorch installed with CUDA)
  2. Setup a conda environment, take your streamlit code to VM with model weight files. Install dependencies.
  3. Open your EC2 instance port to public. (This might help - https://stackoverflow.com/questions/17161345/how-to-open-a-web-server-port-on-ec2-instance)
  4. Run streamlit app. You will get two URLs, 1 IP address and another will be local host.
  5. Copy the IP address URL and paste it on your browser. You should see your streamlit app loading.

I have worked on a similar thing so the above approach should work as per my experience. If not, I think you can check in Streamlit docs.

NOTE - There is a bug in Streamlit. When running any Streamlit app in any cloud VM (OR even local, when passing video/image from some different folder), when you pass video/image via file uploader in Streamlit, the code won't be able to read the image/video because Streamlit doesn't capture the path of file uploaded. Solution - download the video/image, pass it via Streamlit file uploader to a temporary folder and then pass this path to the code.

@joel5638
Copy link
Author

any docker file instructions to be added in the dockerfile?
Like the
FROM and RUN commands to deploy this on docker. an you help me with dockerfile for deployment? If possible.

@SahilChachra
Copy link
Owner

Yeah sure. I will try to add it to this repo by end of the day.

@joel5638
Copy link
Author

Sure Thank you

@joel5638
Copy link
Author

@SahilChachra Hi, any docker image created?

@SahilChachra
Copy link
Owner

@joel5638 Hey. I'm busy with few things for few more days. Sorry for late reply. Will upload the docker file as soon as it's possible.
Thanks!

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