Person-Segmentation-Keras icon indicating copy to clipboard operation
Person-Segmentation-Keras copied to clipboard

Stop at epoch (1/50)

Open 03053020ITE opened this issue 5 years ago • 3 comments

@TianzhongSong 你好,请教一下一个问题 首先我已经照着list格式放置好了dataset和label,为何我下了指令python train_segmentation.py --model='unet' 停止在epoch(1/50) 再麻烦您回复了 万分感谢

03053020ITE avatar Dec 15 '18 04:12 03053020ITE

有解决了吗

jhfmat avatar Jan 15 '19 15:01 jhfmat

I seems to be related to this known issue:

https://stackoverflow.com/questions/48709839/stopiteration-generator-output-nextoutput-generator?noredirect=1&lq=1

I changed the generator function in the utils directory to:

def generator(root_path, path_file, batch_size, n_classes, input_height, input_width, train=True): f = open(path_file, 'r') items = f.readlines() f.close() while True: # <== Move forever loop if train: shuffled_items = [] index = [n for n in range(len(items))] random.shuffle(index) for i in range(len(items)): shuffled_items.append(items[index[i]]) for j in range(len(items) // batch_size): x, y = get_batch(shuffled_items[j * batch_size:(j + 1) * batch_size], root_path, n_classes, input_height, input_width) yield np.array(x), np.array(y) else: for j in range(len(items) // batch_size): x, y = get_batch(items[j * batch_size:(j + 1) * batch_size], root_path, n_classes, input_height, input_width) yield np.array(x), np.array(y)

And it allowed my to train ok.

simon-rob avatar Jan 22 '19 12:01 simon-rob

您好,你现在运行好了吗,我想和您交流一下,我现在也出现了类似的问题

Pythonlushun avatar Jun 13 '19 08:06 Pythonlushun