zh0ngtian / YOLOv2-TensorFlow

Implement the test part of YOLOv2 with TensorFlow.
12 stars 1 forks source link

TypeError: slice indices must be integers or None or have an __index__ method #3

Open maiminh1996 opened 6 years ago

maiminh1996 commented 6 years ago

I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0) Loading complete!

Traceback (most recent call last): File "/home/minh/YOLOv2-test-with-TensorFlow/YOLO_coco_test.py", line 248, in main() File "/home/minh/YOLOv2-test-with-TensorFlow/YOLO_coco_test.py", line 225, in main img_set_out = detect_from_pic(yolo,img_set) File "/home/minh/YOLOv2-test-with-TensorFlow/YOLO_coco_test.py", line 41, in detect_from_pic embeded[dy:dy+new_h,dx:dx+new_w,:] = resized TypeError: slice indices must be integers or None or have an index method

Could you help me?

nhannguyen95 commented 6 years ago

The error is quite clear, maybe one of your dx, dy, new_h, new_w variables is float type.

xiaofeng94 commented 6 years ago

Hi maiminh1996. This error is caused by python version. you may try python2 instead of python3 or use int(*) to wrap every variables which raise such an error.