1

I was using a pre-trained Yolo model for my object detection project. I have downloaded the weight from someone else google drive and using the "YOLOv2" model from this GitHub repo.

My conda environment configuration:

Python 3.6.7 :: Anaconda, Inc.

keras 2.2.4

Tensorflow 1.13.1 backend While running the program, I got the below error:

EDIT: Complete traceback

/home/anubh/anaconda3/envs/cMLdev/bin/python /snap/pycharm-professional/121/helpers/pydev/pydevconsole.py --mode=client --port=42727
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/anubh/PycharmProjects/add_projects/blendid_data_challenge'])
PyDev console: starting.
Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44) 
[GCC 7.3.0] on linux
runfile('/home/anubh/PycharmProjects/codingforfun/machine_learning/deepLearningAI-ANG/week3/car_detection_for_autonomous_driving/pretrain_yolo_model_car_detection.py', wdir='/home/anubh/PycharmProjects/codingforfun/machine_learning/deepLearningAI-ANG/week3/car_detection_for_autonomous_driving')
Using TensorFlow backend.
2019-03-20 11:08:41.522694: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
XXX lineno: 31, opcode: 0
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/snap/pycharm-professional/121/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/snap/pycharm-professional/121/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/anubh/PycharmProjects/codingforfun/machine_learning/deepLearningAI-ANG/week3/car_detection_for_autonomous_driving/pretrain_yolo_model_car_detection.py", line 89, in <module>
    main()
  File "/home/anubh/PycharmProjects/codingforfun/machine_learning/deepLearningAI-ANG/week3/car_detection_for_autonomous_driving/pretrain_yolo_model_car_detection.py", line 86, in main
    out_scores, out_boxes, out_classes = predict(sess, "test.jpg")
  File "/home/anubh/PycharmProjects/codingforfun/machine_learning/deepLearningAI-ANG/week3/car_detection_for_autonomous_driving/pretrain_yolo_model_car_detection.py", line 66, in predict
    yolo_model,class_names, scores, boxes,classes = build_graph(summary_needed=1)
  File "/home/anubh/PycharmProjects/codingforfun/machine_learning/deepLearningAI-ANG/week3/car_detection_for_autonomous_driving/pretrain_yolo_model_car_detection.py", line 30, in build_graph
    yolo_model = load_model("model_data/yolo.h5") # (m, 19, 19, 5, 85) tensor
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/engine/saving.py", line 419, in load_model
    model = _deserialize_model(f, custom_objects, compile)
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/engine/saving.py", line 225, in _deserialize_model
    model = model_from_config(model_config, custom_objects=custom_objects)
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/engine/saving.py", line 458, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize
    printable_module_name='layer')
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/engine/network.py", line 1032, in from_config
    process_node(layer, node_data)
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/engine/network.py", line 991, in process_node
    layer(unpack_singleton(input_tensors), **kwargs)
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/engine/base_layer.py", line 457, in __call__
    output = self.call(inputs, **kwargs)
  File "/home/anubh/anaconda3/envs/cMLdev/lib/python3.6/site-packages/keras/layers/core.py", line 687, in call
    return self.function(inputs, **arguments)
  File "/home/don/tensorflow/yad2k/yad2k/models/keras_yolo.py", line 31, in space_to_depth_x2
SystemError: unknown opcode

I found 2 threads 1 & 2 that tries to answer How to get the TensorFlow binary compiled to support my CPU instructions.

I also found an easy get around at someone's GitHub issue, but the reasoning wasn't clear at all. They are just trying hit & trial.

but, My question is,

In the same environment configuration, I have used ResNet-50 & VGG-16 models for the image classification task, and much other functionality of keras as tensorflow backend and directly with tensorflow. All works with no such error!

Then, what's so special incompatibility Tensorflow issue is with Yolo_v2 model? Could anyone help in this regards as well why and which tensorflow versions would work and how you decide it before working with any model?

Anu
  • 3,198
  • 5
  • 28
  • 49

0 Answers0