updated Reparameterization weight path & added steps for doing Reparameterization ,also fixed few typos (#552)

* Update reparameterization.ipynb

* Update reparameterization.ipynb

* Update reparameterization.ipynb

* Update reparameterization.ipynb

* Update reparameterization.ipynb

* Add files via upload

* Update userdata.sh

fix typo of yolov7
This commit is contained in:
Akash A Desai 2022-09-12 19:52:26 +05:30 committed by GitHub
parent 44d8ab4178
commit 09d6293f32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 9 deletions

View File

@ -8,6 +8,30 @@
"# Reparameterization"
]
},
{
"cell_type": "markdown",
"id": "9725e211",
"metadata": {},
"source": [
"\n",
"### What is Reparameterization ?\n",
"Reparameterization is used to reduce trainable BoF modules into deploy model for fast inference. For example merge BN to conv, merge YOLOR to conv, ..etc\n",
"However, before reparameterization, the model has more parameters and computation cost.reparameterized model (cfg/deploy) used for deployment purpose\n",
"\n",
"\n",
"\n",
"### Steps required for model conversion.\n",
"1.train custom model & you will get your own weight i.e custom_weight.pt / use (pretrained weight which is available i.e yolov7_traing.pt)\n",
"\n",
"2.Converting this weight using Reparameterization method.\n",
"\n",
"3.Trained model (cfg/training) and reparameterized model (cfg/deploy) will get same prediction results.\n",
"However, before reparameterization, the model has more parameters and computation cost.\n",
"\n",
"4.Convert reparameterized weight into onnx & tensorrt\n",
"For faster inference & deployment purpose."
]
},
{
"cell_type": "markdown",
"id": "13393b70",
@ -32,7 +56,7 @@
"\n",
"device = select_device('0', batch_size=1)\n",
"# model trained by cfg/training/*.yaml\n",
"ckpt = torch.load('cfg/training/yolov7.pt', map_location=device)\n",
"ckpt = torch.load('cfg/training/yolov7_training.pt', map_location=device)\n",
"# reparameterized model in cfg/deploy/*.yaml\n",
"model = Model('cfg/deploy/yolov7.yaml', ch=3, nc=80).to(device)\n",
"\n",
@ -94,7 +118,7 @@
"\n",
"device = select_device('0', batch_size=1)\n",
"# model trained by cfg/training/*.yaml\n",
"ckpt = torch.load('cfg/training/yolov7x.pt', map_location=device)\n",
"ckpt = torch.load('cfg/training/yolov7x_trainig.pt', map_location=device)\n",
"# reparameterized model in cfg/deploy/*.yaml\n",
"model = Model('cfg/deploy/yolov7x.yaml', ch=3, nc=80).to(device)\n",
"\n",
@ -156,7 +180,7 @@
"\n",
"device = select_device('0', batch_size=1)\n",
"# model trained by cfg/training/*.yaml\n",
"ckpt = torch.load('cfg/training/yolov7-w6.pt', map_location=device)\n",
"ckpt = torch.load('cfg/training/yolov7-w6_trainig.pt', map_location=device)\n",
"# reparameterized model in cfg/deploy/*.yaml\n",
"model = Model('cfg/deploy/yolov7-w6.yaml', ch=3, nc=80).to(device)\n",
"\n",
@ -328,7 +352,7 @@
"\n",
"device = select_device('0', batch_size=1)\n",
"# model trained by cfg/training/*.yaml\n",
"ckpt = torch.load('cfg/training/yolov7-d6.pt', map_location=device)\n",
"ckpt = torch.load('cfg/training/yolov7-d6_trainig.pt', map_location=device)\n",
"# reparameterized model in cfg/deploy/*.yaml\n",
"model = Model('cfg/deploy/yolov7-d6.yaml', ch=3, nc=80).to(device)\n",
"\n",
@ -414,7 +438,7 @@
"\n",
"device = select_device('0', batch_size=1)\n",
"# model trained by cfg/training/*.yaml\n",
"ckpt = torch.load('cfg/training/yolov7-e6e.pt', map_location=device)\n",
"ckpt = torch.load('cfg/training/yolov7-e6e_trainig.pt', map_location=device)\n",
"# reparameterized model in cfg/deploy/*.yaml\n",
"model = Model('cfg/deploy/yolov7-e6e.yaml', ch=3, nc=80).to(device)\n",
"\n",
@ -487,7 +511,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.7.0 ('py37')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@ -501,7 +525,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
"version": "3.9.7"
},
"vscode": {
"interpreter": {

View File

@ -7,8 +7,8 @@
cd home/ubuntu
if [ ! -d yolor ]; then
echo "Running first-time script." # install dependencies, download COCO, pull Docker
git clone -b paper https://github.com/WongKinYiu/yolor && sudo chmod -R 777 yolor
cd yolor
git clone -b main https://github.com/WongKinYiu/yolov7 && sudo chmod -R 777 yolov7
cd yolov7
bash data/scripts/get_coco.sh && echo "Data done." &
sudo docker pull nvcr.io/nvidia/pytorch:21.08-py3 && echo "Docker done." &
python -m pip install --upgrade pip && pip install -r requirements.txt && python detect.py && echo "Requirements done." &