From 7ccb2921cd8dec287a10a41a0f378427c2f825b5 Mon Sep 17 00:00:00 2001 From: aimspot Date: Thu, 4 Jul 2024 14:53:28 +0300 Subject: [PATCH] fix readme and example --- README.md | 5 +- examples/api_example_ODRS.ipynb | 4 +- examples/example_ODRS.ipynb | 154 ++++++++++++++++---------------- 3 files changed, 83 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index 5cc3f5a..8ee9ff0 100755 --- a/README.md +++ b/README.md @@ -172,6 +172,7 @@ After you have placed your dataset in the folder ***user_datasets/*** and create EPOCHS: 2 IMG_SIZE: 300 + BATCH_SIZE: 16 # MODEL ZOO: # ["yolov5l", "yolov5m", "yolov5n", "yolov5s", "yolov5x", @@ -181,8 +182,10 @@ After you have placed your dataset in the folder ***user_datasets/*** and create # **NOTE**: For successful training of the ssd model, # the size of your images should not exceed 512x512 - MODEL: ssd + # You can also use this format if need to train few models + # MODEL: ['yolov5s', 'yolov5l'] this can also be applied to parameters EPOCHS, BATCH_SIZE, IMG_SIZE + MODEL: ssd # For multiprocessing. # For CPU: diff --git a/examples/api_example_ODRS.ipynb b/examples/api_example_ODRS.ipynb index da89e90..724f113 100644 --- a/examples/api_example_ODRS.ipynb +++ b/examples/api_example_ODRS.ipynb @@ -246,7 +246,7 @@ "id": "QyNYYnRb-yP8" }, "source": [ - "![WaRP-Categories.png](attachment:WaRP-Categories.png)" + "![WaRP-Categories.png](../docs/img/WaRP-Categories.png)" ] }, { @@ -264,7 +264,7 @@ "id": "CmBW9iRq-yP8" }, "source": [ - "![WaRP-Dataset.png](attachment:WaRP-Dataset.png)" + "![WaRP-Dataset](../docs/img/WaRP-Dataset.png)" ] }, { diff --git a/examples/example_ODRS.ipynb b/examples/example_ODRS.ipynb index 67f5787..e480210 100644 --- a/examples/example_ODRS.ipynb +++ b/examples/example_ODRS.ipynb @@ -21,8 +21,8 @@ }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "Cloning into 'ODRS'...\n", "remote: Enumerating objects: 2812, done.\u001b[K\n", @@ -62,8 +62,8 @@ }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "Collecting Pillow==9.5.0 (from -r requirements.txt (line 1))\n", " Downloading Pillow-9.5.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.4 MB)\n", @@ -330,9 +330,9 @@ ] }, { - "output_type": "display_data", "data": { "application/vnd.colab-display-data+json": { + "id": "8186175209264b48affa214e6e067702", "pip_warning": { "packages": [ "PIL", @@ -341,11 +341,11 @@ "numpy", "psutil" ] - }, - "id": "8186175209264b48affa214e6e067702" + } } }, - "metadata": {} + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -364,8 +364,8 @@ }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "/content\n" ] @@ -406,8 +406,8 @@ }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "Cloning into 'WaRP'...\n", "remote: Enumerating objects: 16721, done.\u001b[K\n", @@ -439,7 +439,7 @@ "id": "QyNYYnRb-yP8" }, "source": [ - "![WaRP-Categories.png](attachment:WaRP-Categories.png)" + "![WaRP-Categories.png](../docs/img/WaRP-Categories.png)" ] }, { @@ -457,7 +457,7 @@ "id": "CmBW9iRq-yP8" }, "source": [ - "![WaRP-Dataset.png](attachment:WaRP-Dataset.png)" + "![WaRP-Dataset](../docs/img/WaRP-Dataset.png)" ] }, { @@ -549,9 +549,7 @@ }, { "cell_type": "code", - "source": [ - "%cd ODRS/src/ML/config/" - ], + "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -559,15 +557,17 @@ "id": "Pn0vZ9nj4iyF", "outputId": "6ff0d7c9-0c71-49ec-dec4-fb461d300570" }, - "execution_count": 2, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "/content/ODRS/src/ML/config\n" ] } + ], + "source": [ + "%cd ODRS/src/ML/config/" ] }, { @@ -583,14 +583,13 @@ }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "Before:\n" ] }, { - "output_type": "display_data", "data": { "text/plain": [ "{'GPU': True,\n", @@ -601,18 +600,18 @@ " 'speed': True}" ] }, - "metadata": {} + "metadata": {}, + "output_type": "display_data" }, { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "\n", "After:\n" ] }, { - "output_type": "display_data", "data": { "text/plain": [ "{'GPU': True,\n", @@ -623,7 +622,8 @@ " 'speed': True}" ] }, - "metadata": {} + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -651,9 +651,7 @@ }, { "cell_type": "code", - "source": [ - "%cd .." - ], + "execution_count": 5, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -661,22 +659,22 @@ "id": "loyj0fcAJQJu", "outputId": "011d1ff8-20c6-439e-ebd1-b9c5aced205e" }, - "execution_count": 5, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "/content/ODRS/src/ML\n" ] } + ], + "source": [ + "%cd .." ] }, { "cell_type": "code", - "source": [ - "!python run_recommender.py" - ], + "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -684,11 +682,10 @@ "id": "oQGW30MdJSfE", "outputId": "dadda32a-06d1-49c6-f146-29027a41f7f7" }, - "execution_count": 6, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "2024-06-25 11:26:30.480732: I tensorflow/core/tpu/tpu_api_dlsym_initializer.cc:95] Opening library: /usr/local/lib/python3.10/dist-packages/tensorflow/python/platform/../../libtensorflow_cc.so.2\n", "2024-06-25 11:26:30.480980: I tensorflow/core/tpu/tpu_api_dlsym_initializer.cc:119] Libtpu path is: libtpu.so\n", @@ -706,6 +703,9 @@ "\u001b[32m2024-06-25 11:44:45.793\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mpredict\u001b[0m:\u001b[36m66\u001b[0m - \u001b[1m3) yolov8n\u001b[0m\n" ] } + ], + "source": [ + "!python run_recommender.py" ] }, { @@ -719,9 +719,7 @@ }, { "cell_type": "code", - "source": [ - "%cd ODRS/src/DL/config/" - ], + "execution_count": 11, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -729,46 +727,22 @@ "id": "oxv4_eiXMwER", "outputId": "89409d9a-cb7f-460c-d11d-0724d5ca2147" }, - "execution_count": 11, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "/content/ODRS/src/DL/config\n" ] } + ], + "source": [ + "%cd ODRS/src/DL/config/" ] }, { "cell_type": "code", - "source": [ - "import yaml\n", - "from IPython.display import display\n", - "\n", - "import yaml\n", - "from IPython.display import display\n", - "\n", - "print(\"Before\")\n", - "\n", - "with open('train_config.yaml', 'r') as yaml_file:\n", - " yaml_content = yaml.safe_load(yaml_file)\n", - " display(yaml_content)\n", - "\n", - "# Speed changing\n", - "yaml_content['GPU_COUNT'] = 1\n", - "yaml_content['SELECT_GPU'] = '0'\n", - "yaml_content['MODEL'] = 'yolov7-tiny'\n", - "yaml_content['DATA_PATH'] = '/content/WaRP/Warp-D'\n", - "with open('train_config.yaml', 'w') as yaml_file:\n", - " yaml.dump(yaml_content, yaml_file)\n", - "\n", - "print(\"After\")\n", - "\n", - "with open('train_config.yaml', 'r') as yaml_file:\n", - " yaml_content = yaml.safe_load(yaml_file)\n", - " display(yaml_content)" - ], + "execution_count": 12, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -777,17 +751,15 @@ "id": "CM0F8rbsMv67", "outputId": "65ba87aa-4fd1-44c8-807c-f7cce2dcc393" }, - "execution_count": 12, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "Before\n" ] }, { - "output_type": "display_data", "data": { "text/plain": [ "{'BATCH_SIZE': 20,\n", @@ -802,17 +774,17 @@ " 'SPLIT_VAL_VALUE': 0.1}" ] }, - "metadata": {} + "metadata": {}, + "output_type": "display_data" }, { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "After\n" ] }, { - "output_type": "display_data", "data": { "text/plain": [ "{'BATCH_SIZE': 20,\n", @@ -827,24 +799,52 @@ " 'SPLIT_VAL_VALUE': 0.1}" ] }, - "metadata": {} + "metadata": {}, + "output_type": "display_data" } + ], + "source": [ + "import yaml\n", + "from IPython.display import display\n", + "\n", + "import yaml\n", + "from IPython.display import display\n", + "\n", + "print(\"Before\")\n", + "\n", + "with open('train_config.yaml', 'r') as yaml_file:\n", + " yaml_content = yaml.safe_load(yaml_file)\n", + " display(yaml_content)\n", + "\n", + "# Speed changing\n", + "yaml_content['GPU_COUNT'] = 1\n", + "yaml_content['SELECT_GPU'] = '0'\n", + "yaml_content['MODEL'] = 'yolov7-tiny'\n", + "yaml_content['DATA_PATH'] = '/content/WaRP/Warp-D'\n", + "with open('train_config.yaml', 'w') as yaml_file:\n", + " yaml.dump(yaml_content, yaml_file)\n", + "\n", + "print(\"After\")\n", + "\n", + "with open('train_config.yaml', 'r') as yaml_file:\n", + " yaml_content = yaml.safe_load(yaml_file)\n", + " display(yaml_content)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { - "id": "ggGkXaKU-yP9", - "outputId": "91df932d-1e5e-47f2-85c9-7ae5e39a6779", "colab": { "base_uri": "https://localhost:8080/" - } + }, + "id": "ggGkXaKU-yP9", + "outputId": "91df932d-1e5e-47f2-85c9-7ae5e39a6779" }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "/content/ODRS/src/DL\n" ] @@ -858,16 +858,16 @@ "cell_type": "code", "execution_count": 14, "metadata": { - "id": "KUWdpHSapxLh", "colab": { "base_uri": "https://localhost:8080/" }, + "id": "KUWdpHSapxLh", "outputId": "34599612-e096-4870-d295-3da22b08a63f" }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "\u001b[32m2024-06-25 11:54:42.169\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36msrc.data_processing.data_utils.utils\u001b[0m:\u001b[36mget_data_path\u001b[0m:\u001b[36m74\u001b[0m - \u001b[1mCopying a set of images to /content/ODRS/user_datasets\u001b[0m\n", "\u001b[32m2024-06-25 11:54:48.542\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36msrc.data_processing.data_utils.split_dataset\u001b[0m:\u001b[36msplit_data\u001b[0m:\u001b[36m35\u001b[0m - \u001b[1mDataset is ready\u001b[0m\n", @@ -1059,4 +1059,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +}