停止迭代深度学习_UNet

时间:2021-06-24 12:41:30

标签: python deep-learning iteration google-colaboratory unity3d-unet

我在处理停止迭代时遇到问题

这包括使用迭代模式用图像填充变量,另一个用我的驱动器中的掩码填充变量。

如果能得到您的帮助,我将不胜感激

TRAIN_PATH = '/content/drive/MyDrive/PFE_MOHTICH/dataset/train'
TEST_PATH = '/content/drive/MyDrive/PFE_MOHTICH/dataset/test'

train_ids = next(os.walk(TRAIN_PATH))[1]
test_ids = next(os.walk(TEST_PATH))[1]

X_train = np.zeros((len(train_ids), IMG_HEIGHT, IMG_WIDTH, IMG_CHANNELS), dtype=np.uint8)
Y_train = np.zeros((len(train_ids), IMG_HEIGHT, IMG_WIDTH, 1), dtype=np.bool)

print('Resizing training images and masks')
for i in tqdm(enumerate(train_ids), total=len(train_ids)):   
    path = TRAIN_PATH + '/' + i
    img = imread(path + '/images/' + '/' + i + '.tiff')[:,:,:IMG_CHANNELS]  
    img = resize(img, (IMG_HEIGHT, IMG_WIDTH), mode='constant', preserve_range=True)
    X_train[n] = img  #Fill empty X_train with values from img
    mask_ = imread(path + '/masks/' + mask_file)
    mask_ = resize(mask_, (IMG_HEIGHT, IMG_WIDTH), mode='constant', preserve_range=True) 
    Y_train[n] = mask_
-----------------------------------Error-------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-13-dbe48adf915c> in <module>()
      2 TEST_PATH = '/content/drive/MyDrive/PFE_MOHTICH/dataset/test'
      3 
----> 4 train_ids = next(os.walk(TRAIN_PATH))[1]
      5 test_ids = next(os.walk(TEST_PATH))[1]
      6 

StopIteration: 

0 个答案:

没有答案