ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.87k stars 16.38k forks source link

YOLOv5 container on AWS Marketplace #6502

Open g0lemXIV opened 2 years ago

g0lemXIV commented 2 years ago

Search before asking

Description

I want to write an article about SageMaker model training especially Object Detection models. The choice fell on yolov5 because you've done fantastic work! Is it possible to make this a feature for the repository?

I can make a complete pipeline for training the yolov5 model and deploying it as an endpoint/batch transform as containers available on AWS Marketplace.

Use case

Training: A user wants to train the yolov5 model on AWS Sagemaker but doesn't have experience. Users can "fork" ready-to-use containers from the marketplace and use them for training.

Deploying: A user can use the yolov5 container to deploy a custom or pretrained model with a few clicks.

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 2 years ago

👋 Hello @g0lemXIV, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

glenn-jocher commented 2 years ago

@g0lemXIV this sounds like an awesome idea! I haven't used sagemaker myself, I've been to busy drinking coffee and making the world's best vision AI over here on GitHub haha.

We do have Docker images ready to go here. These are created with Docker Autobuild and are always up to date with master: https://hub.docker.com/r/ultralytics/yolov5

We also have a quick AWS tutorial meant for using YOLOv5 on EC2: https://docs.ultralytics.com/yolov5/environments/aws_quickstart_tutorial/

But no sagemaker or marketplace images! What do we need to do to get started? Could you help explain the steps and what's required from us? Thanks!

EDIT: I've reached out to our Amazon contact to see if they can help us get registered on Marketplace so we can provide an official container.

g0lemXIV commented 2 years ago

@glenn-jocher basically, SageMaker is a complete data science platform with data labelling, training, deploying and hyperparameters optimization. You also have standard notebooks to prototype. So it is possible to get a fully working model within the marketplace, train it or deploy it in a few minutes.

Because you've done fantastic work with torch hub for deployment, we need only one script similar to this aws-code

The training differs because we need a specific setting through the .sh / .py script, but I've done similar work in the past.

We can make deployment scripts and add them to the aws marketplace it may work similarly to mxnet-yolov3

Where in settings, users can:

Then I think we can take care of the training container. What do you think?

glenn-jocher commented 2 years ago

@g0lemXIV I've reached out to AWS but am having trouble getting their team to return emails. I don't want to drag our feet on this since it seems like a great idea. Can you take the lead on this and let me know what next steps are and what I can do to help?

ghost commented 2 years ago

@g0lemXIV Hi, have you managed to deploy yolov5 to sagemaker ?

g0lemXIV commented 2 years ago

@sinatimelapse it is relatively easy with yolov5 torch hub and this script inference.py for pytroch

@glenn-jocher sorry that I didn't respond. I had a busy month... I think I will do the commitment in the next two weeks for inference script and then for training.

glenn-jocher commented 2 years ago

@g0lemXIV great thanks!

ghost commented 2 years ago

@g0lemXIV Could you elaborate more please ? I've never used sagemaker !

g0lemXIV commented 2 years ago

@sinatimelapse please read a few examples about sagemaker, sagemaker SDK and then look at the inference.py again. It will be pretty easy tho to do this. Otherwise, you can wait for scripts for yolov5, I can notify you when I pr.

(edit) You have there a full example in a jupyter notebook with the code. code for pytorch inference You need to implement image loading, loading model from torch hub, make inference and finally return JSON with bbox or image

ghost commented 2 years ago

Thank you for your answer, I'm new on AWS, I would be very happy if you notify me when you commit the scripts for yolov5.

ghost commented 2 years ago

@g0lemXIV Hello, have you uploaded the yolov5's scripts, I didn't manage to deploy yolov5 to sagemaker, thank you in advance.

glenn-jocher commented 2 years ago

@g0lemXIV @sinatimelapse I've reached out again to AWS but they have been unresponsive unfortunately.

g0lemXIV commented 2 years ago

@sinatimelapse do not stalk people on each social media platform!

Because you deleted the tweet since I responded. I write it again here When I have time I will work on those scripts. Open Source doesn't mean "do by other hands!". I've explained to you how to deploy yolov5 on the sagemaker. If you still have problems with those I can do this for you faster for cash

Do not stalk me on mail, LinkedIn, Twitter, etc...

ghost commented 2 years ago

@g0lemXIV as far as I can see I have not stalked you I juste wanted a response from you since you have not responded here, I thought that you have not read my question, I've done the same thing with someone else and they have answered to my question kindly, if you don't want to help or you don't know the answer, juste say it, and I'm not asking you to work at my place, I'm juste curious to know how you managed to deploy it on sagemaker, the forums are created for helping each other, not for disrespecting each other.

g0lemXIV commented 2 years ago

@sinatimelapse As far as I know, I helped you with the comment above pointing to all necessary scripts that help deploy the model on aws. If you don't understand that, you should reserve your time to study sagemaker not to irritate people on all possible channels. That's all from me.

ghost commented 2 years ago

sorry, I have never meant to irritate you, please accept my sincere excuses, have a good day !

glenn-jocher commented 2 years ago

@g0lemXIV @sinatimelapse alright guys I'm on this. I travelled from Madrid, Spain to the AWS summit in San Francisco this week, and I'm meeting in person with their Marketplace and Sagemaker teams to get YOLOv5 officially represented and launched on both.

This must be the most personalized service ever for an open-source AI 😂.

IMG_1680

ghost commented 2 years ago

Wonderful news, I can't wait to see this

g0lemXIV commented 2 years ago

@glenn-jocher I found that aws prepare a sample for local deployment with the yolov5 package here: https://github.com/aws-samples/amazon-sagemaker-local-mode/tree/main/pytorch_yolov5_local_model_inference Creating the model package and inference endpoint/batch transform needs to be changed from local mode to sagemaker instance to generate the model package and inference endpoint/batch transform.

pablosnascimento commented 1 year ago

Any updates about it?! :D

glenn-jocher commented 1 year ago

@pablosnascimento thank you for your interest in YOLOv5. We are constantly looking for ways to improve the project and make it more accessible to everyone. As for the AWS Marketplace and SageMaker integration, we have made progress in this area and are actively working on it. We will be sure to update the community once it becomes available. Thank you for your patience and support!

aounleonardo commented 9 months ago

Hi @glenn-jocher thanks for you effort so far! Any update on this though?

aounleonardo commented 9 months ago

(edit) You have there a full example in a jupyter notebook with the code. code for pytorch inference You need to implement image loading, loading model from torch hub, make inference and finally return JSON with bbox or image

Wouldn't this throw an error if yolov5 is not installed in the image uri? @g0lemXIV

glenn-jocher commented 5 months ago

Hi there! If YOLOv5 is not already installed in the image used by SageMaker, you will indeed encounter errors when trying to run inference. To avoid this, ensure that your Docker container has YOLOv5 installed either by building it into your Dockerfile or by installing it as part of the setup process before running your Jupyter notebook. This way, all necessary dependencies are in place when you execute your code. 😊