IBM Support

How to resolve the issue that name 'cv2' is not defined

How To


Summary

When you run the deep learning training, it reports the below error:
Traceback (most recent call last):
File "/dli_shared_fs/tools/dataset/main.py", line 1265, in <module>
_dataset_create()
File "/dli_shared_fs/tools/dataset/main.py", line 319, in _dataset_create
tensorflow_dataset.main(output_dir, train_file, val_file, test_file, width, height,resize_type, resize_mode, encoding, shards, byclass)
File "/dli_shared_fs/tools/dataset/frameworks/tensorflow/core.py", line 213, in main
convert2TFRecords(train_file,'train',output_dir,height,width, shards, byclass)
File "/dli_shared_fs/tools/dataset/frameworks/tensorflow/core.py", line 119, in convert2TFRecords
image = extract_image(example, resize_height, resize_width)
File "/dli_shared_fs/tools/dataset/frameworks/tensorflow/core.py", line 45, in extract_image
image = cv2.imread(filename)
NameError: name 'cv2' is not defined

Document Location

Worldwide


[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSZU2E","label":"IBM Spectrum Conductor with Spark"},"Component":"","Platform":[{"code":"PF016","label":"Linux"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

More support for:
IBM Spectrum Conductor with Spark

Software version:
All Versions

Operating system(s):
Linux

Document number:
872524

Modified date:
19 July 2019

UID

ibm10872524

Manage My Notification Subscriptions