コード例 #1
0
import config
from util import data_loader
from util import losses
from util import keras_util
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(
    k_fold_file="1.txt",
    model_path=os.path.abspath(__file__),
    image_resolution=400,
    data_type=[config.DATA_TYPE_ORIGINAL],
    label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    label_color_augment=[0, 1, 3, 5, 6, 7, 9, 10, 11, 12],
    train_batch_size=[16, 16, 16],
    label_up_sampling=[10, 0, 0, 10, 0, 0, 10, 0, 0, 0, 0, 0, 10],
    data_visualization=True,
    initial_epoch=4,
    downsampling=0.5,
    val_batch_size=128,
    predict_batch_size=128,
    epoch=[1, 3, 5],
    lr=[0.001, 0.0001, 0.00001],
    freeze_layers=[-1, 0.6, 5],
    tta_flip=True,
    input_norm=False)


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.ResNet50(
        include_top=False,
        weights=weights,
コード例 #2
0
from keras.layers import Dense, BatchNormalization, Activation

import config
from util import data_loader
from util import keras_util
from util import losses
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(k_fold_file="1.txt",
                                model_path=os.path.abspath(__file__),
                                image_resolution=224,
                                data_type=[config.DATA_TYPE_ORIGINAL],
                                label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
                                train_batch_size=[32, 32],
                                data_visualization=True,
                                val_batch_size=256,
                                predict_batch_size=256,
                                epoch=[2, 10],
                                lr=[0.0001, 0.00001],
                                clr=True,
                                freeze_layers=[0.1, 0.1],
                                tta_flip=True,
                                input_norm=False)


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.DenseNet169(include_top=False, weights=weights,
                                             input_shape=model_config.image_shape, pooling="avg")

    x = base_model.output
    x = Dense(256, use_bias=False)(x)
コード例 #3
0
import keras
from keras.layers import Dense, BatchNormalization, Activation

import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(
    k_fold_file="1.txt",
    model_path=os.path.abspath(__file__),
    image_resolution=224,
    data_type=[config.DATA_TYPE_ORIGINAL],
    label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    label_up_sampling=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0],
    train_batch_size=[32, 32, 32],
    val_batch_size=256,
    predict_batch_size=256,
    epoch=[1, 4, 10],
    lr=[0.001, 0.0001, 0.00001],
    data_visualization=True,
    freeze_layers=[-1, 0.6, 5],
    tta_flip=True,
    tta_crop=True)


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.DenseNet169(
        include_top=False,
        weights=weights,
        input_shape=model_config.image_shape,
        pooling="avg")
コード例 #4
0
import keras
from keras.layers import Dense, BatchNormalization, Activation

import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(
    k_fold_file="1.txt",
    model_path=os.path.abspath(__file__),
    image_resolution=224,
    data_type=[config.DATA_TYPE_ORIGINAL],
    label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    label_color_augment=[0, 1, 3, 5, 6, 7, 9, 10, 11, 12],
    train_batch_size=[16, 16, 16],
    initial_epoch=1,
    val_batch_size=256,
    predict_batch_size=256,
    epoch=[1, 4, 10],
    lr=[0.0005, 0.00005, 0.000005],
    data_visualization=True,
    freeze_layers=[-1, 0.6, 5])


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.DenseNet201(
        include_top=False,
        weights=weights,
        input_shape=model_config.image_shape,
        pooling="avg")
コード例 #5
0
import time

import keras
from keras.layers import Dense, BatchNormalization, Activation

import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(k_fold_file="1.txt",
                                model_path=os.path.abspath(__file__),
                                image_resolution=224,
                                data_type=[config.DATA_TYPE_ORIGINAL],
                                label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
                                train_batch_size=[16, 16, 16],
                                val_batch_size=256,
                                predict_batch_size=256,
                                epoch=[1, 4, 12],
                                lr=[0.001, 0.0001, 0.00001],
                                freeze_layers=[-1, 0, 0])


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.DenseNet201(include_top=False, weights=weights,
                                                input_shape=model_config.image_shape, pooling="avg")

    x = base_model.output
    x = Dense(256, use_bias=False)(x)
    x = BatchNormalization()(x)
    x = Activation("relu")(x)
コード例 #6
0
import keras
from keras.layers import Dense, BatchNormalization, Activation

import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(k_fold_file="1.txt",
                                model_path=os.path.abspath(__file__),
                                image_resolution=224,
                                data_type=[config.DATA_TYPE_ORIGINAL],
                                label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
                                label_up_sampling=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50],
                                downsampling=0.5,
                                train_batch_size=[16, 16, 16],
                                data_visualization=True,
                                val_batch_size=256,
                                predict_batch_size=256,
                                epoch=[1, 4, 8],
                                lr=[0.0005, 0.00005, 0.000005],
                                freeze_layers=[-1, 0.9, 0.7])


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.DenseNet201(include_top=False, weights=weights,
                                                input_shape=model_config.image_shape, pooling="avg")

    x = base_model.output
    x = Dense(256, use_bias=False)(x)
    x = BatchNormalization()(x)
コード例 #7
0
from keras.layers import Dense, BatchNormalization, Activation

import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(
    k_fold_file="1.txt",
    model_path=os.path.abspath(__file__),
    image_resolution=224,
    data_type=[config.DATA_TYPE_ORIGINAL],
    label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    label_color_augment=[0, 1, 3, 5, 6, 7, 9, 10, 11, 12],
    label_up_sampling=[0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    data_visualization=True,
    downsampling=0.8,
    train_batch_size=[32, 32, 32],
    val_batch_size=256,
    predict_batch_size=256,
    epoch=[2, 4, 10],
    lr=[0.0005, 0.00005, 0.000005],
    freeze_layers=[-1, 0.6, 5],
    input_norm=False)


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.DenseNet169(
        include_top=False,
        weights=weights,
        input_shape=model_config.image_shape,
コード例 #8
0
import keras
from keras.layers import Dense, BatchNormalization, Activation

import config
from util import data_loader
from util import keras_util
from util import metrics
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(
    k_fold_file="1.txt",
    image_resolution=224,
    model_path=os.path.abspath(__file__),
    data_type=[config.DATA_TYPE_SEGMENTED],
    label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    train_batch_size=[32, 32, 32],
    val_batch_size=64,
    predict_batch_size=128,
    epoch=[1, 6, 12],
    lr=[0.001, 0.0001, 0.00001],
    freeze_layers=[-1, 0.5, 0])


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.InceptionV3(
        weights=weights,
        include_top=False,
        input_shape=model_config.image_shape,
        pooling="max")
    x = base_model.output
    x = Dense(256, activation="relu", use_bias=False)(x)
コード例 #9
0
from keras.layers import Dense

import config
from util import data_loader
from util import keras_util
from util import metrics
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(
    k_fold_file="1.txt",
    model_path=os.path.abspath(__file__),
    image_resolution=360,
    data_type=[config.DATA_TYPE_ORIGINAL],
    label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    label_color_augment=[0, 1, 3, 5, 6, 7, 9, 10, 11, 12],
    train_batch_size=[16, 16],
    val_batch_size=128,
    predict_batch_size=128,
    epoch=[2, 6],
    lr=[0.0001, 0.00001],
    freeze_layers=[0, 0],
    tta_flip=True,
    data_visualization=True)


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.Xception(
        include_top=False,
        weights=weights,
        input_shape=model_config.image_shape,
        pooling="avg")
コード例 #10
0
import config
from util import data_loader
from util import keras_util
from util import metrics
from util.keras_util import KerasModelConfig

model_config = KerasModelConfig(
    k_fold_file="1.txt",
    model_path=os.path.abspath(__file__),
    image_resolution=324,
    data_type=[config.DATA_TYPE_ORIGINAL],
    label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    label_color_augment=[0, 1, 3, 5, 6, 7, 9, 10, 11, 12],
    train_batch_size=[16, 16],
    label_up_sampling=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20],
    data_visualization=True,
    downsampling=0.8,
    val_batch_size=256,
    predict_batch_size=256,
    epoch=[1, 6],
    lr=[0.0001, 0.00001],
    freeze_layers=[5, 5],
    tta_crop=True)


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights="imagenet"):
    base_model = keras.applications.InceptionV3(
        weights=weights,
        include_top=False,
        input_shape=model_config.image_shape,
コード例 #11
0
import keras
from keras.layers import Dense, BatchNormalization, Activation, Flatten, GlobalAveragePooling2D

import config
from util import data_loader
from util import keras_util
from util.keras_util import KerasModelConfig
from util import path

model_config = KerasModelConfig(k_fold_file="1.txt",
                                model_path=os.path.abspath(__file__),
                                image_resolution=224,
                                data_type=[config.DATA_TYPE_ORIGINAL],
                                label_position=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
                                label_color_augment=[0, 1, 3, 5, 6, 7, 9, 10, 11, 12],
                                label_up_sampling=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50],
                                downsampling=0.8,
                                train_batch_size=[16, 16, 16],
                                val_batch_size=128,
                                predict_batch_size=128,
                                epoch=[1, 4, 8],
                                lr=[0.001, 0.0001, 0.00001],
                                freeze_layers=[-1, 0.6, 5])


def get_model(freeze_layers=-1, lr=0.01, output_dim=1, weights=os.path.join(path.root_path, 'resnet152_weights_tf.h5')):
    base_model = resnet152.resnet152_model(resolution=model_config.image_resolution, weights_path=weights)
    base_model.layers.pop()
    base_model.layers.pop()
    x = GlobalAveragePooling2D()(base_model.layers[-1].output)
    x = Dense(256, use_bias=False)(x)
    x = BatchNormalization()(x)