-
Notifications
You must be signed in to change notification settings - Fork 42
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
Yolov8 Object Detection PyTorch tutorial #1030
Conversation
|
||
|
||
def yolov8_preprocess(x: np.ndarray, img_mean: float = 0.0, img_std: float = 255.0, pad_values: int = 114, | ||
size: Tuple[int, int] = (640, 640)) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a problem of code duplication. I think eventually we will need to create a preprocess folder, that contains the preprocess methods. for now, maybe just unify the 2 functions to 1 function of yolov8_preprocess...
from model_compression_toolkit.core.pytorch.pytorch_device_config import get_working_device | ||
|
||
|
||
def model_predict(model: Any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe to include this function in the yolov8.py file? I'm thinking maybe we should create a template for each model (a class) that includes the required functions.. let's do it in a different PR
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from tutorials.mct_model_garden.models_pytorch.yolov8.yolov8 import DetectionModelPyTorch, yaml_load\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space with empty line
"source": [ | ||
"from tutorials.mct_model_garden.models_pytorch.yolov8.yolov8 import DetectionModelPyTorch, yaml_load\n", | ||
"cfg_dict = yaml_load(\"./local_mct/tutorials/mct_model_garden/models_pytorch/yolov8/yolov8n.yaml\", append_filename=True) # model dict\n", | ||
"model = DetectionModelPyTorch.from_pretrained(\"SSI-DNN/pytorch_yolov8n_640x640_bb_decoding\", cfg=cfg_dict)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check if passing the yaml is a must? if not better to remove it.
"!pip install onnx\n", | ||
"!pip install -q pycocotools\n", | ||
"!pip install huggingface-hub==0.21.3\n", | ||
"!pip install --pre sony-custom-layers-dev==0.2.0.dev1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check if the version limitation is required? if not better to remove it.
}, | ||
"source": [ | ||
" Clone a copy of the [MCT](https://github.com/sony/model_optimization) (Model Compression Toolkit) into your current directory. This step ensures that you have access to [MCT Models Library](https://github.com/sony/model_optimization/tree/main/tutorials/mct_model_garden) folder which contains all the necessary utility functions for this tutorial.\n", | ||
" **It's important to note that we use the most up-to-date MCT code available.**" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MCT Models Library --> MCT Models Garden
* Yolov8 Object Detection PyTorch tutorial * Add Yolov8 Object Detection to the PyTorch MCT Model Garden * The PyTorch implementation of Yolov8n object detection model, following https://github.com/ultralytics/ultralytics. This implementation includes a slightly modified version of the yolov8 detection-head optimized for model quantization.
Pull Request Description:
Add Yolov8 Object Detection PyTorch tutorial using multiclass_nms from sony_cusom_layers
Checklist before requesting a review: