YOLOv2 icon indicating copy to clipboard operation
YOLOv2 copied to clipboard

"ValueError : low >= high" in darknet19_train.py

Open kakutit opened this issue 7 years ago • 3 comments

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 delta_val_scale=0.5 File "/home/kaku/Desktop/YOLOv2-master/lib/image_generator.py", line 180, in generate_samples bg = self.bgs[np.random.randint(len(self.bgs))] File "mtrand.pyx", line 988, in mtrand.RandomState.randint (numpy/random/mtrand/mtrand.c:16157) ValueError: low >= high

================================================================================= REALLY NEED HELP, PLEASE

kakutit avatar Sep 07 '17 12:09 kakutit

I got same error!

libennext avatar Oct 06 '17 06:10 libennext

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".

diningyo avatar Oct 22 '17 02:10 diningyo

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.

kakutit avatar Nov 02 '17 13:11 kakutit