Training with SSD Mobilenetv2 with roboflow 2023 environment errors

275 Views Asked by At

So I'm using the google colab notebook for training ssd mobilenetv2 models. The colab notebook in question is:

https://colab.research.google.com/drive/1wTMIrJhYsQdq_u7ROOkf0Lu_fsX5Mu8a?ref=blog.roboflow.com

I'm aware that this training notebook may be a bit dated, but I need it for the project I'm doing.

When I attempted to download the block under "Install required packages", I receive this error:

I'm wondering if anyone else has encountered this issue, and if they did, what did they do to get around it? Is there any other Mobilenet notebooks which have more up to date object detection training? What are good alternatives than to this notebook I'm currently using for my roboflow project?

Thank you, any help would be appreciated.

When I attempted to download the block under "Install required packages", I receive this error:

(Notebook block)

%cd /content !git clone --quiet https://github.com/tensorflow/models.git

pip install tf_slim

apt-get install -qq protobuf-compiler python-pil python-lxml python-tk

pip install -q Cython contextlib2 pillow lxml matplotlib

pip install -q pycocotools

pip install lvis

%cd /content/models/research !protoc object_detection/protos/*.proto --python_out=.

import os
os.environ['PYTHONPATH'] += ':/content/models/research/:/content/models/research/slim/'

pip install numpy==1.19.5 pip uninstall -y pycocotools pip install pycocotools --no-binary pycocotools

python object_detection/builders/model_builder_test.py

Log for error:

/content Requirement already satisfied: tf_slim in /usr/local/lib/python3.10/dist-packages (1.1.0) Requirement already satisfied: absl-py>=0.2.2 in /usr/local/lib/python3.10/dist-packages (from tf_slim) (1.4.0) E: Unable to locate package python-pil E: Unable to locate package python-lxml Collecting lvis Downloading lvis-0.5.3-py3-none-any.whl (14 kB) Requirement already satisfied: cycler>=0.10.0 in /usr/local/lib/python3.10/dist-packages (from lvis) (0.11.0) Requirement already satisfied: Cython>=0.29.12 in /usr/local/lib/python3.10/dist-packages (from lvis) (3.0.2) Requirement already satisfied: kiwisolver>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from lvis) (1.4.5) Requirement already satisfied: matplotlib>=3.1.1 in /usr/local/lib/python3.10/dist-packages (from lvis) (3.7.1) Requirement already satisfied: numpy>=1.18.2 in /usr/local/lib/python3.10/dist-packages (from lvis) (1.23.5) Requirement already satisfied: opencv-python>=4.1.0.25 in /usr/local/lib/python3.10/dist-packages (from lvis) (4.8.0.76) Requirement already satisfied: pyparsing>=2.4.0 in /usr/local/lib/python3.10/dist-packages (from lvis) (3.1.1) Requirement already satisfied: python-dateutil>=2.8.0 in /usr/local/lib/python3.10/dist-packages (from lvis) (2.8.2) Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.10/dist-packages (from lvis) (1.16.0) Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.1->lvis) (1.1.0) Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.1->lvis) (4.42.1) Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.1->lvis) (23.1) Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.1->lvis) (9.4.0) Installing collected packages: lvis Successfully installed lvis-0.5.3 /content/models/research Collecting numpy==1.19.5 Downloading numpy-1.19.5.zip (7.3 MB) 7.3/7.3 MB 20.2 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: numpy error: subprocess-exited-with-error

Building wheel for numpy (pyproject.toml) did not run successfully. exit code: 1 See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. Building wheel for numpy (pyproject.toml) ... error ERROR: Failed building wheel for numpy Failed to build numpy ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects Found existing installation: pycocotools 2.0.7 Uninstalling pycocotools-2.0.7: Successfully uninstalled pycocotools-2.0.7 Collecting pycocotools Downloading pycocotools-2.0.7.tar.gz (24 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: matplotlib>=2.1.0 in /usr/local/lib/python3.10/dist-packages (from pycocotools) (3.7.1) Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from pycocotools) (1.23.5) Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (1.1.0) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (4.42.1) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (1.4.5) Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (23.1) Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (9.4.0) Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (3.1.1) Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=2.1.0->pycocotools) (2.8.2) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib>=2.1.0->pycocotools) (1.16.0) Building wheels for collected packages: pycocotools Building wheel for pycocotools (pyproject.toml) ... done Created wheel for pycocotools: filename=pycocotools-2.0.7-cp310-cp310-linux_x86_64.whl size=380282 sha256=1807e19ac777b3912f0292a2339baafbf033fbff6297cf5f8ef6b8fc7f025f64 Stored in directory: /root/.cache/pip/wheels/40/b5/c8/9afe18bb3839192bffca22717e7b85080b1f847c57216d868f Successfully built pycocotools Installing collected packages: pycocotools Successfully installed pycocotools-2.0.7 2023-09-22 01:53:22.870453: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-09-22 01:53:23.882070: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Traceback (most recent call last): File "/content/models/research/object_detection/builders/model_builder_test.py", line 20, in <module> from object_detection.builders import model_builder File "/content/models/research/object_detection/builders/model_builder.py", line 37, in <module> from object_detection.meta_architectures import deepmac_meta_arch File "/content/models/research/object_detection/meta_architectures/deepmac_meta_arch.py", line 28, in <module> import tensorflow_io as tfio # pylint:disable=g-import-not-at-top ModuleNotFoundError: No module named 'tensorflow_io'

It appears as though tensorflow_io is not found. Anyways, I continued the training out of curiosity to see what would happen if I were to train my model anyway. This is the block of code I used for training vs the result:

The code under "Train the model":

!python /content/models/research/object_detection/model_main.py
--pipeline_config_path={pipeline_fname}
--model_dir={model_dir}
--alsologtostderr
--num_train_steps={num_steps}
--num_eval_steps={num_eval_steps}

The Error I received:

2023-09-22 01:28:26.115815: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Traceback (most recent call last): File "/content/models/research/object_detection/model_main.py", line 26, in <module> from object_detection import model_lib File "/content/models/research/object_detection/model_lib.py", line 31, in <module> from object_detection import exporter as exporter_lib File "/content/models/research/object_detection/exporter.py", line 24, in <module> from object_detection.builders import model_builder File "/content/models/research/object_detection/builders/model_builder.py", line 37, in <module> from object_detection.meta_architectures import deepmac_meta_arch File "/content/models/research/object_detection/meta_architectures/deepmac_meta_arch.py", line 28, in <module> import tensorflow_io as tfio # pylint:disable=g-import-not-at-top ModuleNotFoundError: No module named 'tensorflow_io'

Again, I received that same error as before, with tensorflow_io.

0

There are 0 best solutions below