- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Following the steps in (https://github.com/openvinotoolkit/training_extensions/blob/misc/models/object_detection/model_templates/horizontal-text-detection/readme.md)
python export.py \
--load-weights ${SNAPSHOT} \
--save-model-to export
I got this error
Traceback (most recent call last):
File "/home/kai/Desktop/training_extensions-misc/external/mmdetection/tools/export.py", line 24, in <module>
from onnxoptimizer import optimize
ModuleNotFoundError: No module named 'onnxoptimizer'
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I already installed onnx version 1.10.0 and when I tried to install onnxoptimizer with
pip install onnxoptimizer
It went to error with the comments
ERROR: Command errored out with exit status 1: /home/kai/Desktop/training_extensions-misc/models/object_detection/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bu96limb/onnxoptimizer_c53b604a683d4e11b6ef413a1ea4cec8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bu96limb/onnxoptimizer_c53b604a683d4e11b6ef413a1ea4cec8/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-a0ccia3t/install-record.txt --single-version-externally-managed --compile --install-headers /home/kai/Desktop/training_extensions-misc/models/object_detection/venv/include/site/python3.6/onnxoptimizer Check the logs for full command output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kai28,
Thank you for reaching out to us.
Could you please provide detailed information for the following so that we can further investigate this issue from our end:
- OS version
- Python version
- OpenVINO version
- Steps you used for installing OpenVINO Training Extension
Regarding the pip install onnxoptimizer error, you might need to upgrade your pip and re-install 'onnxoptimizer' and see if the issue is resolved.
pip install --upgrade pip
From my end, I was able to successfully install onnxoptimizer on my system:
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for replying me.
OS: ubuntu 18.04
Python: 3.6.9
Openvino: 4.5.3
I downloaded all the source code from (https://github.com/openvinotoolkit/training_extensions/tree/misc) and also from (https://github.com/openvinotoolkit/training_extensions/tree/misc/external) import into external file.
After upgrading my pip, the issue is still there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kai28,
Thank you for sharing your information.
I've encountered similar issue when pip install onnxoptimizer on Ubuntu 18.04.
We are investigating this issue further and will update you at the earliest.
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kai28,
Thank you for your patience.
Upon detailed investigation of this issue, we found the reason for the installation error of onnxoptimizer is due to incompatible version. Using default pip install will attempt to get the latest version (0.3.13) which is incompatible with Ubuntu 18.04 (Python 3.6).
There are also other modifications you'll need to do in order to complete the Horizontal Text Detection guide. Here is the full list of steps that I've performed and successfully Run demo with exported model:
1. Download OpenVINO Toolkit 2021.4.2 for Linux OS.
2. Follow Install and Configure Intel® Distribution of OpenVINO™ toolkit for Linux.
3. Clone OpenVINO Training Extensions repository:
git clone https://github.com/openvinotoolkit/training_extensions.git
export OTE_DIR=`pwd`/training_extensions
4. Clone Open Model Zoo repository to run demos:
git clone https://github.com/openvinotoolkit/open_model_zoo --branch 2021.4.2
export OMZ_DIR=`pwd`/open_model_zoo
5. Change directory to object_detection:
cd /training_extensions/models/object_detection
6. Create virtual environment:
./init_venv.sh
7. Activate virtual environment:
source venv/bin/activate
8. Modify the onnxoptimizer and onnx versions in the following runtime.txt file:
/training_extensions/external/mmdetection/requirements/runtime.txt
onnx==1.10.1
onnxoptimizer==0.2.6
9. Install MMDetection inside the virtual environment:
cd /training_extensions/external/mmdetection/
pip install -r requirements/build.txt
pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"
pip install -v -e .
10. Continue Step 2 in Horizontal Text Detection guide.
cd /training_extensions/models/object_detection
export MODEL_TEMPLATE=`realpath ./model_templates/horizontal-text-detection/horizontal-text-detection-0001/template.yaml`
export WORK_DIR=/tmp/my-$(basename $(dirname $MODEL_TEMPLATE))
export SNAPSHOT=snapshot.pth
python ../../tools/instantiate_template.py ${MODEL_TEMPLATE} ${WORK_DIR}
11. Continue Step 3. Try a pre-trained model
cd ${WORK_DIR}
python export.py \
--load-weights ${SNAPSHOT} \
--save-model-to export
python ${OMZ_DIR}/demos/object_detection_demo/python/object_detection_demo.py \
-m export/model.xml \
-at ssd \
-i /dev/video0
Troubleshooting steps:
If you encounter ModuleNotFoundError: No module named 'mmcv._ext', you'll need to downgrade CUDA to version 10.2. Refer this github discussion for more info.
If you encounter RuntimeError: OpenVINO Model Optimizer is not found or configured properly, please ensure you've completed the steps in Step 4: Configure the Model Optimizer.
If the error persists, you'll need to provide the full PATH for mo.py inside of the /mmdetection/tools/export.py file (Line 154,171,179 and 185).
FULL PATH for mo.py:
/opt/intel/openvino_2021.4.752/deployment_tools/model_optimizer/mo.py
Hope this helps.
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your assistance.
I followed until step 11 then encountered an error:
No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
.
.
ModuleNotFoundError: No module named 'mmcv._ext'
I have installed CUDA 10.2.
Does it mean that my GPU is not capable for CUDA?
Intel iRIS xe graphics with Intel Core i5.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kai28,
For clarification purposes, are you facing this issue when executing the 4.Fine-tune section which involves training of the model?
CUDA toolkit is optional if you have an NVIDIA GPU available and intend to train the model using GPU instead of CPU. Since, you do not have NVIDIA GPU, the model training should run on CPU by default.
Run the following command to ensure CUDA is installed:
nvcc --version
Please ensure you have mmcv-full 1.3.0 installed in the environment. Additionally, I've attached a text file containing the list of installed modules in my environment for your reference.
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I encounter this issue when I execute this step
python export.py \ --load-weights ${SNAPSHOT} \ --save-model-to export
I checked my CUDA and it is installed.
I also checked my list of installed modules, mmcv-full 1.3.0 is in the environment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kai28,
From my end, I did not encounter "No CUDA runtime is found, using CUDA_HOME=' /usr/local/cuda-10.2'" error message.
However, I did encounter "No module named 'mmcv._ext'" error as CUDA 11.1 was previously installed in my system and thus, I had to downgrade it to CUDA 10.2.
During the downgrade process, I specified the path for the CUDA libraries using the following commands:
echo 'export PATH=/usr/local/cuda-10.2/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
Here is the guide that I used to downgrade my CUDA version (This is an external link and is not maintained by Intel):
How to downgrade CUDA on Linux | Change CUDA versions for Torch/Tensorflow
You might want to specify the path for CUDA libraries and see if the issue is resolved.
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As always, thanks for the support.
This time, I reinstalled my CUDA after removing it. I also specified the path for CUDA libraries using
echo 'export PATH=/usr/local/cuda-10.2/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
I checked my CUDA and it is successfully installed.
Same as before, I still encounter "No CUDA runtime is found, using CUDA_HOME=' /usr/local/cuda-10.2" and "No module named 'mmcv._ext'" when I run
python export.py \ --load-weights ${SNAPSHOT} \ --save-model-to export
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kai28,
From my findings, there's a GitHub thread discussion regarding the "No CUDA runtime is found, using CUDA_HOME=' /usr/local/cuda-10.2" error.
Try running the following command and re-run the export.py to see if the issue is resolved:
export FORCE_CUDA="1"
If the error persists, I'd suggest you open up a question in the OpenVINO Training Extensions GitHub page for further help regarding this issue.
Hope this helps.
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kai28,
This thread will no longer be monitored since we have provided suggestion. If you need any additional information from Intel, please submit a new question.
Regards,
Hairul
![](/skins/images/4399995709D76C02984DDB9A1DB96C28/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page