Skip to content

Commit

Permalink
code review modification
Browse files Browse the repository at this point in the history
  • Loading branch information
eladco committed Oct 7, 2024
1 parent 91baa46 commit 2598c16
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 20 deletions.
19 changes: 16 additions & 3 deletions tutorials/mct_model_garden/models_pytorch/yolox/darknet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# ===========================================================================================
# The following code was adopted from https://github.com/Megvii-BaseDetection/YOLOX
# ===========================================================================================
# ------------------------------------------------------------------------------
# This file contains code from the https://github.com/Megvii-BaseDetection/YOLOX repository.
# Copyright (c) 2021-2022 Megvii Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------------


import torch
from torch import nn
Expand Down
16 changes: 16 additions & 0 deletions tutorials/mct_model_garden/models_pytorch/yolox/yolox.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# ------------------------------------------------------------------------------
# This file contains code from the https://github.com/Megvii-BaseDetection/YOLOX repository.
# Copyright (c) 2021-2022 Megvii Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------------

# The following code was mostly duplicated from https://github.com/Megvii-BaseDetection/YOLOX
# and changed to generate an equivalent PyTorch model suitable for quantization.
# Main changes:
Expand Down
15 changes: 15 additions & 0 deletions tutorials/mct_model_garden/models_pytorch/yolox/yolox.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright 2024 Sony Semiconductor Israel, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

nano:
depth: 0.33
width: 0.25
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
# Copyright 2024 Sony Semiconductor Israel, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# ===========================================================================================
# The following code was adopted from https://github.com/Megvii-BaseDetection/YOLOX
# ===========================================================================================

import numpy as np
from typing import Tuple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"\n",
"In this tutorial, we will illustrate a basic and quick process of preparing a pre-trained model for deployment using MCT. Specifically, we will demonstrate how to download a pre-trained pytorch YOLOX-Tiny model, compress it, and make it deployment-ready using MCT's post-training quantization techniques.\n",
"\n",
"We will use an existing pre-trained YOLOX-Tiny model based on [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX). The model was slightly adjusted for model quantization. We will quantize the model using MCT post training quantization technique and evaluate the performance of the floating point model and the quantized model on COCO dataset.\n",
"We will use an existing pre-trained YOLOX-Tiny model based on [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) and integrate Box decoding and NMS to the model. The model was slightly adjusted for model quantization. We will quantize the model using MCT post training quantization technique and evaluate the performance of the floating point model and the quantized model on COCO dataset.\n",
"\n",
"\n",
"## Summary\n",
Expand Down Expand Up @@ -48,8 +48,7 @@
"!pip install -q torch\n",
"!pip install onnx\n",
"!pip install -q pycocotools\n",
"!pip install --pre 'sony-custom-layers-dev>=0.2.0.dev5'\n",
"# TODO change to !pip install 'sony-custom-layers' when new release\n"
"!pip install 'sony-custom-layers'"
],
"outputs": [],
"execution_count": null
Expand Down

0 comments on commit 2598c16

Please sign in to comment.