Ejemplo n.º 1
0
    # instantiate datagenerator class
    test_set = Dataloader(image_paths=test_imagepath,
                          mask_paths=test_maskpath,
                          vector_paths=test_vector_path,
                          image_size=input_size,
                          numclasses=num_of_Classes,
                          channels=[3, 3],
                          palette=palette,
                          seed=47)

    # evaluation parameters
    BS = 1

    # initialize data generators with threading lock
    testgen = threadsafe_iter(
        test_set.data_gen(should_augment=False, batch_size=BS))

    No_of_test_images = len(os.listdir(test_imagepath))
    print("Number of Test Images = {}".format(No_of_test_images))

    eval = evaluation(input_size,
                      num_of_Classes,
                      palette,
                      pretrained_unet='output/Checkpoint_Weights.h5',
                      pretrained_fcn='models/FCN_weights.h5',
                      pretrained_segnet='models/SegNet_weights.h5',
                      unet=True,
                      fcn=False,
                      segnet=False)

    eval.evaluate(testgenerator=testgen,
Ejemplo n.º 2
0
                     numclasses=num_of_Classes,
                     channels=[3, 3],
                     palette=palette,
                     seed=47)

# Build Model
model_FCN = FCN.build((352, 352, 3), num_of_Classes, pretrained_weights="FCN_weights.h5")
model_FCN.summary()

# learning parameters
INIT_LR = 0.001
EPOCHS = 100
BS = 2

# initialize data generators
traingen = threadsafe_iter(train_set.data_gen(should_augment=True, batch_size=BS))
valgen = threadsafe_iter(val_set.data_gen(should_augment=False, batch_size=BS))

# Print INFO
No_of_train_images = len(os.listdir(dataset_path + '/train_frames/train'))
No_of_val_images = len(os.listdir(dataset_path + '/val_frames/val'))
print("Number of Training Images = {}".format(No_of_train_images))

# optimizer
opt = Adam(lr=INIT_LR, decay=0.0000001)

# early stopping parameters and Saving Training Data
weights_path = os.getcwd() + '/output/weights.h5'
checkpoint = ModelCheckpoint(weights_path, monitor='val_loss', verbose=1, save_best_only=True, mode='min')
csvlogger = CSVLogger('./log_FCN.out', append=True, separator=';')
earlystopping = EarlyStopping(monitor='val_loss', verbose=1, min_delta=0.001, patience=50, mode='min', baseline=0.5)