Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

image translation model

gb8
New Contributor I
1,222 Views

When using  'omz_converter',

   segmentation_model, hrnet-v2-c1-segmentation.xml created.

But 'translation_model, cocosnet.xml doesn't.

 

Document says,

  -m_trn TRANSLATION_MODEL : required

  -m_seg SEGMENTATION_MODEL : optional

And running the demo without translation model produces error as follows,

  error message : ipykernel_launcher.py: error: the following arguments are required: -m_trn/--translation_model, -o/--output_dir

 

gb8

 

0 Kudos
1 Solution
Peh_Intel
Moderator
1,079 Views

Hi gb8,


There are two ways to run with this demo. You can refer to commands here.


Besides, there are also some fixes to the preprocessing for Segmentation and Translation models.


Please modify these two files (models.py and preprocessing.py) in the

<omz>/demos/image_translation_demo/python/image_translation_demo directory.


Here are the changes that required to be made.



Regards,

Peh


View solution in original post

0 Kudos
14 Replies
Vladimir_Dudnik
Employee
1,212 Views

@gb8 what was the issue of using omz_converter ?

Note, when you want to load models for particular demo, it might be convenient to use models.lst file from demo folder as a parameter for omz_downloaded or omz_converter tools.

I've just tried under OpenVINO 2022.1 python environment

omz_downloader --list <omz_dir>/demos/image_translation_demo/python/models.lst -o <out_dir>

omz_converter --list <omz_dir>/demos/image_translation_demo/python/models.lst -o <out_dir> -d <out_dir> --precisions FP16

 

and models listed in models.lst file were downloaded and converted

 

Remember, when you install openvino-dev into python environment where you plan to convert the models to IR, you also need specify extra dependencies for frameworks you are going to use (or simple list all supported OpenVINO frameworks)

 

you can do so by running command like this:

pip install openvino==2022.1 openvino-dev[caffe,onnx,tensorflow2,pytorch,mxnet,paddle,kaldi]==2022.1

This will install OpenVINO runtime and tools and also all required deps of proper versions to make conversion to IR from all these frameworks.

0 Kudos
gb8
New Contributor I
1,190 Views

After model_downloader command, folder structure is as follows,

 

2022-04-06 09_21_16-model_files.png

2022-04-06 09_20_32-ckpt.png

2022-04-06 09_20_50-networks.png

2022-04-06 09_21_02-util.png

 

So, model download seems to be completed normally.

download command  in vscode is : 

os.system("omz_downloader --list models.lst -o /home/pi/code/models --cache_dir /home/pi/code/models/cache")
 

I converted the models as following command in vscode'

  - os.system("omz_converter --list models.lst -d /home/pi/code/models -o /home/pi/code/models")
 
And segmentation model was converted well as I mentioned earlier.
Suggestion : some kind of downloader, converter command result message ( success, fail and more info.) would be helpful.
 
gb8
0 Kudos
gb8
New Contributor I
1,187 Views

note)

  above convert command produces '256'.

 

0 Kudos
gb8
New Contributor I
993 Views

I am very sorry.

I overlooked the output message of downloader and converter because it is so long and always did well for other examples.

There is converting error for cocosnet as follows:

============================================

 

 

0 Kudos
gb8
New Contributor I
993 Views
0 Kudos
Peh_Intel
Moderator
1,152 Views

Hi gb8,

 

Below are the results that I convert CocosNet model via Command Prompt. As you see, the result messages (success, fail and info) are shown.

,

Fail.jpegSuccess.jpeg

 

I tried to convert CocosNet model without installing the dependencies and the conversion was failed.

 

Please make sure you run the command below to install the dependencies:

pip install openvino-dev[pytorch]==2022.1

 

 

Regards,

Peh

 

0 Kudos
gb8
New Contributor I
1,144 Views

Hi Peh.

Your mention succeed.

Former result : I installed using comand someday before as follows,

  - 'pip install ‘openvino-dev[caffe, kaldi, mxnet, onnx, pytorch, tensorflow2]’

 

Now using comamnd,  - 'pip install openvino-dev[pytorch]==2022.1'

it succeed.

Is there difference between  the two pip command?

Thanks a lot.

 

gb8

 

 

0 Kudos
Peh_Intel
Moderator
1,139 Views

Hi gb8,


Thanks for confirming you are running well now.


Both pip commands are actually the same, the only difference is just to specify the version. Installing OpenVINO™ from PyPI without specifying the version, it will install the latest version at that moment.



Regards,

Peh 


0 Kudos
gb8
New Contributor I
1,112 Views

Peh.

Thank you for detailed explanation.

After installation successful, I ran the demo according to doc, it says only '-ri'(reference images) argument is required, and other images are optional.

Running with that argument, it shows error as follows:

=====================================

gb8_1-1649573398490.png

 

==========================================

So I rearranged arguments like '-ii imagefile -ri imagefile' (same image file for test), then error message is as follows:

gb8_0-1649573220550.png

I am not familiar with image translation, I just want to introduce this model to people.

For this demonstration to work, Can I get suitable images ? If possible.

 

gb8

 

0 Kudos
Peh_Intel
Moderator
1,080 Views

Hi gb8,


There are two ways to run with this demo. You can refer to commands here.


Besides, there are also some fixes to the preprocessing for Segmentation and Translation models.


Please modify these two files (models.py and preprocessing.py) in the

<omz>/demos/image_translation_demo/python/image_translation_demo directory.


Here are the changes that required to be made.



Regards,

Peh


0 Kudos
gb8
New Contributor I
1,066 Views

OK. 

I see.

I am not familiar with image translation as mentioned before, 

I would rather postpone the test until everything is fixed.

I respect you for hard work if not impossible.

 

Thanks a lot.

 

gb8

 

0 Kudos
Peh_Intel
Moderator
1,051 Views

Hi gb8,

 

I’ve validated the demo works fine on my side after modifying these two files (models.py and preprocessing.py).

 

Command used:

python image_translation_demo.py -m_trn cocosnet.xml -m_seg hrnet-v2-c1-segmentation.xml -ii horse.jpg -ri zebra.jpg -o output

 

example.JPG

 

Besides, I also attached these two modified files as well. You can replace these two files in the directory below:

<omz>/demos/image_translation_demo/python/image_translation_demo

 

 

Regards,

Peh

 

0 Kudos
gb8
New Contributor I
1,037 Views

Yes. I tested it and everything is OK.

Thank you.

 

gb8

0 Kudos
Peh_Intel
Moderator
1,020 Views

Hi gb8,


This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question. 



Regards,

Peh


0 Kudos
Reply