divamgupta / image-segmentation-keras

Implementation of Segnet, FCN, UNet , PSPNet and other models in Keras.
https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html
MIT License
2.92k stars 1.16k forks source link

hyper parameter tuning #192

Open sadransh opened 4 years ago

sadransh commented 4 years ago

Hi, I'm totally new to these kinds of networks.

Can anybody help me with hyperparameter tuning for a specific architecture(e.g. unet) ?

for example changing activation functions, num of filters padding or ...?

Where Can I start doing so? Am I thinking about it correctly? Since I have very low mIoU and I think the problem is that the hyperparameters should tune maybe performing Bayesian optimization on hyperparameter?

simenkf commented 4 years ago

Have you tried all default parameters using transfer learning? E.g. PSPNet with weights from ADE20K? How many images do you have in your dataset?

sadransh commented 4 years ago

@simenkf Hi, my dataset has 45 main images (2Kx1.5k) images I have made them cut them to 640x320 and then augmented to 180 images. I tried with several networks like ( resnet50_unit, unet, pspnet segnet .... both with aug and w/o aug ) mIoU was about 0.30 for all.

I tried to do what you told, It stops after copying the weights!

simenkf commented 4 years ago

Is it hanging or terminating? Are you sure you start train training? My code looks kik this and works fine (although image augmentation messes things up ...):

pretrained_model = pspnet_50_ADE_20K()
model = pspnet_50(n_classes=2)#, input_height=256, input_width=256)

transfer_weights(pretrained_model, model)

EPOCHS = 30
BATCH_SIZE = 2

history = model.train(
    verify_dataset=False,
    batch_size=BATCH_SIZE,
    validate=True,
    steps_per_epoch=426//BATCH_SIZE,
    val_steps_per_epoch=120//BATCH_SIZE,
    train_images=os.path.join('dataset', 'train_images'),
    train_annotations=os.path.join("dataset", 'train_segmentation'),
    val_images=os.path.join('dataset', 'val_images'),
    val_annotations=os.path.join("dataset", 'val_segmentation'),
    checkpoints_path=os.path.join('checkpoints', 'pspnet'),
    epochs=EPOCHS,
    optimizer_name='adadelta',
)