f5d152d30e53fd6fadb04d10a7388648a0c3826e,examples/train_pascal.py,,,#,51

Before Change


    model = create_model(weights=args.weights)

    // compile model (note: set loss to None since loss is added inside layer)
    model.compile(
        loss={
            "regression"    : keras_retinanet.losses.smooth_l1(),
            "classification": keras_retinanet.losses.focal()
        },
        optimizer=keras.optimizers.adam(lr=1e-5, clipnorm=0.001)
    )

    // print model summary
    print(model.summary())

    // create image data generator objects
    train_image_data_generator = keras.preprocessing.image.ImageDataGenerator(
        horizontal_flip=True,
    )
    val_image_data_generator = keras.preprocessing.image.ImageDataGenerator()

    // create a generator for training data
    train_generator = PascalVocGenerator(
        args.voc_path,
        "trainval",
        train_image_data_generator,
        batch_size=args.batch_size
    )

    // create a generator for testing data
    val_generator = PascalVocGenerator(
        args.voc_path,
        "test",
        val_image_data_generator,
        batch_size=args.batch_size
    )

    // start training
    model.fit_generator(
        generator=train_generator,
        steps_per_epoch=len(train_generator.image_names) // args.batch_size,
        epochs=50,
        verbose=1,
        validation_data=val_generator,
        validation_steps=3000,  // len(val_generator.image_names) // args.batch_size,
        callbacks=[
            keras.callbacks.ModelCheckpoint(os.path.join("snapshots", "resnet50_voc_best.h5"), monitor="val_loss", verbose=1, save_best_only=True),
            keras.callbacks.ReduceLROnPlateau(monitor="val_loss", factor=0.1, patience=10, verbose=1, mode="auto", epsilon=0.0001, cooldown=0, min_lr=0),
        ],
    )

    // store final result too
    model.save(os.path.join("snapshots", "resnet50_voc_final.h5"))

After Change



    // create the model
    print("Creating model, this may take a second...")
    model, training_model, prediction_model = create_models(weights=args.weights, multi_gpu=args.multi_gpu)

    // compile model (note: set loss to None since loss is added inside layer)
    training_model.compile(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 18

Instances


Project Name: fizyr/keras-retinanet
Commit Name: f5d152d30e53fd6fadb04d10a7388648a0c3826e
Time: 2017-11-28
Author: j.c.gaiser@delftrobotics.com
File Name: examples/train_pascal.py
Class Name:
Method Name:


Project Name: fizyr/keras-retinanet
Commit Name: da4848e1156edd2076b881ce2300ae2d3cc18246
Time: 2017-12-03
Author: j.c.gaiser@delftrobotics.com
File Name: examples/train_coco.py
Class Name:
Method Name:


Project Name: fizyr/keras-retinanet
Commit Name: f5d152d30e53fd6fadb04d10a7388648a0c3826e
Time: 2017-11-28
Author: j.c.gaiser@delftrobotics.com
File Name: examples/train_pascal.py
Class Name:
Method Name:


Project Name: fizyr/keras-retinanet
Commit Name: f5d152d30e53fd6fadb04d10a7388648a0c3826e
Time: 2017-11-28
Author: j.c.gaiser@delftrobotics.com
File Name: examples/train_coco.py
Class Name:
Method Name:


Project Name: fizyr/keras-retinanet
Commit Name: da4848e1156edd2076b881ce2300ae2d3cc18246
Time: 2017-12-03
Author: j.c.gaiser@delftrobotics.com
File Name: examples/train_pascal.py
Class Name:
Method Name: