Beispiel #1
0
        out_file = r'/home/oanhnt/thainh/data/database/train-opt{}.pickle'.format(opt_size)
    else:
        out_file = r'/home/oanhnt/thainh/data/database/test-opt{}.pickle'.format(opt_size)
    valid_file = r'/home/oanhnt/thainh/data/database/test-opt{}.pickle'.format(opt_size)
else:
    if train:
        out_file = '/mnt/smalldata/database/train-opt2.pickle'
    else:
        out_file = '/mnt/smalldata/database/test-opt2.pickle'

# Spatial
input_x = Input(shape=(224,224,3))
if train:
    x = mobilenet.mobilenet_by_me(
        name='spatial', 
        inputs=input_x, 
        input_shape=(224,224,3), 
        classes=classes,
        weight='weights/mobilenet_spatial_{}e.h5'.format(spa_epochs))
else:
    x = mobilenet.mobilenet_by_me(
        name='spatial', 
        inputs=input_x, 
        input_shape=(224,224,3), 
        classes=classes)

# Temporal
input_y = Input(shape=(224,224,20))
if train:
    y = mobilenet.mobilenet_by_me(
        name='temporal', 
        inputs=input_y, 
classes = int(sys.argv[7])

server = config.server()
if server:
    if train:
        out_file = r'/home/oanhnt/thainh/data/database/train-all.pickle'
    else:
        out_file = r'/home/oanhnt/thainh/data/database/test-all.pickle'
    valid_file = r'/home/oanhnt/thainh/data/database/test-all.pickle'

# Spatial
input_x = Input(shape=(224, 224, 3))
if train:
    x = mobilenet.mobilenet_by_me(
        name='spatial',
        inputs=input_x,
        input_shape=(224, 224, 3),
        classes=classes,
        weight='weights/mobilenet_spatial_{}e.h5'.format(spa_epochs))
else:
    x = mobilenet.mobilenet_by_me(name='spatial',
                                  inputs=input_x,
                                  input_shape=(224, 224, 3),
                                  classes=classes)

# Temporal 1
input_y1 = Input(shape=(224, 224, 20))
if train:
    y1 = mobilenet.mobilenet_by_me(
        name='temporal1',
        inputs=input_y1,
        input_shape=(224, 224, 20),
Beispiel #3
0
        valid_file = r'{}database/test-opt{}.pickle'.format(
            data_output_path, opt_size)
    else:
        out_file = r'{}database/test-opt{}.pickle'.format(
            data_output_path, opt_size)
else:
    out_file = r'{}database/cross-opt{}.pickle'.format(data_output_path,
                                                       opt_size)

# Spatial
input_x = Input(shape=(224, 224, 3))
if train:
    x = mobilenet.mobilenet_by_me(name='spatial',
                                  inputs=input_x,
                                  input_shape=(224, 224, 3),
                                  classes=classes,
                                  weight='weights/spatial_{}e_cr{}.h5'.format(
                                      spa_epochs, cross_index),
                                  non_train=True)
else:
    x = mobilenet.mobilenet_by_me(name='spatial',
                                  inputs=input_x,
                                  input_shape=(224, 224, 3),
                                  classes=classes)

# Temporal
input_y = Input(shape=(224, 224, 20))
if train:
    y = mobilenet.mobilenet_by_me(
        name='temporal',
        inputs=input_y,
        out_file = r'{}database/test-all.pickle'.format(data_output_path)
else:
    out_file = r'{}database/cross-all.pickle'.format(data_output_path)

inputs = []
outputs = []
for i in range(len(multi_opt_size)):
    opt = multi_opt_size[i]
    if opt == 0:
        # Spatial
        input_x = Input(shape=(224,224,3))
        inputs.append(input_x)
        if train:
            x = mobilenet.mobilenet_by_me(
                name='spatial', 
                inputs=input_x, 
                input_shape=(224,224,3), 
                classes=classes,
                weight='weights/spatial_{}e_cr{}.h5'.format(pretrains[i],cross_index))
        else:
            x = mobilenet.mobilenet_by_me(
                name='spatial', 
                inputs=input_x, 
                input_shape=(224,224,3), 
                classes=classes)

        outputs.append(x)
    else:
        # Temporal
        input_y = Input(shape=(224,224,20))
        inputs.append(input_y)
        if train:
Beispiel #5
0
        [K.count_params(p) for p in set(model.non_trainable_weights)])

    total_memory = 4.0 * batch_size * (shapes_mem_count + trainable_count +
                                       non_trainable_count)
    gbytes = np.round(total_memory / (1024.0**3), 3)
    return gbytes


classes = 11
depth = 20
drop_rate = 0.5

input_x = Input(shape=(224, 224, 3))

x = mobilenet.mobilenet_by_me(name='spatial',
                              inputs=input_x,
                              input_shape=(224, 224, 3),
                              classes=classes)

# Temporal
input_y1 = Input(shape=(224, 224, 20))
input_y2 = Input(shape=(224, 224, 20))
input_y3 = Input(shape=(224, 224, 20))
inputs = [input_y1, input_y2, input_y3]

y = mobilenet.mobilenet_new(name='temporal',
                            inputs=inputs,
                            input_shape=(224, 224, 20),
                            classes=classes)

z = Concatenate()([x, y])
z = GlobalAveragePooling2D()(z)