From 6bb7c2e463d4efb8f36f8046f94806480e5f26aa Mon Sep 17 00:00:00 2001 From: Surya Kari Date: Mon, 27 Jun 2022 12:06:16 -0700 Subject: [PATCH 1/2] Added FP16 Example --- samples/PT37_opengpu/README.md | 71 ++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/samples/PT37_opengpu/README.md b/samples/PT37_opengpu/README.md index e5adad9..e682ed0 100644 --- a/samples/PT37_opengpu/README.md +++ b/samples/PT37_opengpu/README.md @@ -1,22 +1,71 @@ # Run YoloV5s Model on AWS Panorama using Torch + TorchVision ## Brief -In this guide, we show how to use a Yolov5s model with PyTorch GPU on the Panorama device. +In this guide, we show how to use a Yolov5s model with PyTorch GPU on the Panorama device. -## Model +## Downloading Model and Source Code -We have already included the yolov5s.pt model in -``` -./dependencies/model -``` +To download the /dependencies and ./packages/src folder -Copy this model to +* Run aws configure on a terminal on your Test Utility +* Open the pytorch_example.ipynb +* Run the code in the notebook until this line is run -``` -aws-panorama-samples/samples/PT37_opengpu/yolov5s_37_app/packages/028663699634-yolov5s_37_app-1.0/src/yolov5s_model/ -``` +```panorama_test_utility.download_artifacts_gpu_sample('pytorch', account_id)``` +* You will now see two folders + * ```./dependencies/model``` + * ```./yolov5s_37_2_app/packages/-yolov5s_37_2_app/src``` + + +## Models Included + +We have already included two models in +* ```./dependencies/model``` +* ```./yolov5s_37_2_app/packages/-yolov5s_37_2_app/src/yolov5s_model``` +* The two models included are + * yolov5s.pt ==> FP32 Model + * yolov5s_half.pt ==> FP16 Model + +## Use FP32 Model + +To use the FP32 model do this + +* In ```aws-panorama-samples/samples/PT37_opengpu/yolov5s_37_2_app/packages/-yolov5s_37_2_app-1.0/descriptor.json```, make sure the descriptor looks like this + + ``` + { + "runtimeDescriptor": + { + "envelopeVersion": "2021-01-01", + "entry": + { + "path": "python3.7", + "name": "/panorama/yolov5/app.py" + } + } + } + ``` + +## Use FP16 Model + +* In ```aws-panorama-samples/samples/PT37_opengpu/yolov5s_37_2_app/packages/-yolov5s_37_2_app-1.0/descriptor.json```, make sure the descriptor looks like this + + ``` + { + "runtimeDescriptor": + { + "envelopeVersion": "2021-01-01", + "entry": + { + "path": "python3.7", + "name": "/panorama/yolov5/app_fp16.py" + } + } + } + ``` +* To note is that the FP16 model does not have post processing / Visualization code built in. Please use the code from the FP32 (app.py) if you would like visualization as part of this app -## Download Pre-Built model (Optional) +## Download a Pre-Built model instead (Optional) You can download a pre-built model from the yolov5s ultralytics github repository here : [Link](https://github.com/ultralytics/yolov5). ``` From aef29589506d3f1f8a5ced9e8f9cebe260c83834 Mon Sep 17 00:00:00 2001 From: Surya Kari Date: Mon, 27 Jun 2022 12:12:46 -0700 Subject: [PATCH 2/2] Example of YoloV5s + FP16 --- samples/PT37_opengpu/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/PT37_opengpu/README.md b/samples/PT37_opengpu/README.md index e682ed0..f924b71 100644 --- a/samples/PT37_opengpu/README.md +++ b/samples/PT37_opengpu/README.md @@ -23,8 +23,8 @@ We have already included two models in * ```./dependencies/model``` * ```./yolov5s_37_2_app/packages/-yolov5s_37_2_app/src/yolov5s_model``` * The two models included are - * yolov5s.pt ==> FP32 Model - * yolov5s_half.pt ==> FP16 Model + * yolov5s.pt ==> (FP32 Model) + * yolov5s_half.pt ==> (FP16 Model) ## Use FP32 Model @@ -148,4 +148,4 @@ The assets should look something like this # Debugging -If you encounter issues with deploying from this, once the application is uploaded to the cloud, you can use the graph.json and deploy using the Panorama console as well \ No newline at end of file +If you encounter issues with deploying from this, once the application is uploaded to the cloud, you can use the graph.json and deploy using the Panorama console as well