allanzelener / YAD2K

YAD2K: Yet Another Darknet 2 Keras
Other
2.71k stars 879 forks source link

ValueError: Cannot feed value of shape (1, 416, 416) for Tensor 'input_1:0', which has shape '(?, 416, 416, 3) #155

Open rtrahms opened 5 years ago

rtrahms commented 5 years ago

I have converted my already trained YoloV2 network (cfg, weights) into an h5 file, and am attempting to use test_yolo.py model_data/yoloV2_ob_23.h5 -c model_data/ob23_classes.txt. I have a default yolo_anchors.txt file. The model, anchors and classes are loaded, but then when loading images (3-channel 800x600 jpgs) the script crashes. Looks like the network is expecting single channel image data (maybe).

Am I missing a preprocessing step? Any thoughts here? Thanks.

rtrahms commented 5 years ago

(keras) C:\DATA\Git_Repositories\YAD2K>python test_yolo.py -a model_data/test_out_anchors.txt -c model_data/ob23_classes.txt model_data/test_out.h5 Using TensorFlow backend. 2018-12-01 13:44:56.303378: I C:\users\nwani_bazel_nwani\mmtm6wb6\execroot\org_tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX 2018-12-01 13:44:56.642818: I C:\users\nwani_bazel_nwani\mmtm6wb6\execroot\org_tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1356] Found device 0 with properties: name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.8475 pciBusID: 0000:01:00.0 totalMemory: 8.00GiB freeMemory: 6.60GiB 2018-12-01 13:44:56.651100: I C:\users\nwani_bazel_nwani\mmtm6wb6\execroot\org_tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1435] Adding visible gpu devices: 0 2018-12-01 13:44:57.704800: I C:\users\nwani_bazel_nwani\mmtm6wb6\execroot\org_tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-12-01 13:44:57.709110: I C:\users\nwani_bazel_nwani\mmtm6wb6\execroot\org_tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:929] 0 2018-12-01 13:44:57.712977: I C:\users\nwani_bazel_nwani\mmtm6wb6\execroot\org_tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:942] 0: N 2018-12-01 13:44:57.716702: I C:\users\nwani_bazel_nwani\mmtm6wb6\execroot\org_tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6372 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0, compute capability: 6.1) c:\Users\Rob\Anaconda3\envs\keras\lib\site-packages\keras\engine\saving.py:270: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually. warnings.warn('No training configuration found in save file: ' num_classes = 23 num_anchors = 5 model_data/test_out.h5 model, anchors, and classes loaded. loading images... image = (800, 600) image_data shape = (1, 416, 416) Traceback (most recent call last): File "test_yolo.py", line 205, in _main(parser.parse_args()) File "test_yolo.py", line 158, in _main K.learning_phase(): 0 File "c:\Users\Rob\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\client\session.py", line 900, in run run_metadata_ptr) File "c:\Users\Rob\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\client\session.py", line 1111, in _run str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (1, 416, 416) for Tensor 'input_1:0', which has shape '(?, 416, 416, 3)'

rtrahms commented 5 years ago

Found the problem. I am using unique JPG filenames that are fairly long, and have a number of periods in them (DICOM & date references in name). Apparently the code doesn't like this. By using a more standard set of filenames (no periods, shorter), everything works great. Thanks!