YOLOv2
YOLOv2 copied to clipboard
"ValueError : low >= high" in darknet19_train.py
hey guys, i got the value error when i tried the training tutorial. the below is the whole message
=================================================================================
loading image generator...
loading model...
/home/kaku/anaconda3/lib/python3.5/site-packages/chainer/cuda.py:90: UserWarning: cuDNN is not enabled.
Please reinstall chainer after you install cudnn
(see https://github.com/pfnet/chainer#installation).
'cuDNN is not enabled.\n'
start training
Traceback (most recent call last):
File "darknet19_train.py", line 62, in
================================================================================= REALLY NEED HELP, PLEASE
I got same error!
Maybe you forget to run "download_images.py". So self.bgs doesn't have any items. Thus, len(self.bgs) == 0, and match the condition "ValueError: low >= high".
solved. I changed image_generator.py file code to below from the 70th line "random_overlay_image" function.
=================================================================================
def random_overlay_image(src_image, overlay_image, minimum_crop): src_h, src_w = src_image.shape[:2] overlay_h, overlay_w = overlay_image.shape[:2] shift_item_h, shift_item_w = overlay_h * (1-minimum_crop), overlay_w * (1-minimum_crop) scale_item_h, scale_item_w = overlay_h * (minimum_crop2-1), overlay_w * (minimum_crop2-1)
# eva = src_h-scale_item_h
# if eva <0:
# eva = 0
if src_h <= scale_item_h:
src_h, scale_item_h = scale_item_h, src_h
sh = src_h - scale_item_h
a = np.random.randint(sh)
#print(a)
y = int(a - shift_item_h)
if src_w <= scale_item_w:
src_w, scale_item_w = scale_item_w, src_w
sw = src_w - scale_item_w
b = np.random.randint(sw)
#print(b)
x = int(b - shift_item_w)
# y = int(np.random.randint(eva) - shift_item_h)
#print(src_w-scale_item_w)
# if (src_w-scale_item_w)<0:
# (src_w-scale_item_w)*(-1)
# print(src_w-scale_item_w)
# x = int(np.random.randint(src_w-scale_item_w) - shift_item_w)
# gelion = src_w-scale_item_w
# if gelion<0:
# gelion = 0
# x = int(np.random.randint(gelion) - shift_item_w)
image = overlay(src_image, overlay_image, x, y)
bbox = ((np.maximum(x, 0), np.maximum(y, 0)), (np.minimum(x+overlay_w, src_w-1), np.minimum(y+overlay_h, src_h-1)))
return image, bbox
=================================================================================
make sure DO NOT run "./setup.sh" when you want to do the training tutorial.(this command will erase all downloaded image data like backgrounds, items) then just run the "python darknet19_train.py", i think the code will run correctly.