Ejemplo n.º 1
0
 def __init__(self, input_size=(640, 480)):
     self.C = config.Config()
     self.C.offset = True
     self.C.size_test = input_size
     input_shape_img = (self.C.size_test[0], self.C.size_test[1], 3)
     img_input = Input(shape=input_shape_img)
     # define the network prediction
     preds = nn.nn_p3p4p5(img_input, offset=self.C.offset, num_scale=self.C.num_scale, trainable=True)
     self.model = Model(img_input, preds)
     self.model_path = '/root/webapp/detector/models_weight'
     self.detec_hum(np.random.rand(200, 300, 3))
Ejemplo n.º 2
0
C.size_test = (1024, 2048)
input_shape_img = (C.size_test[0], C.size_test[1], 3)
img_input = Input(shape=input_shape_img)

# define the base network (resnet here, can be MobileNet, etc)
if C.network == 'resnet50':
    from keras_csp import resnet50 as nn
elif C.network == 'mobilenet':
    from keras_csp import mobilenet as nn
else:
    raise NotImplementedError('Not support network: {}'.format(C.network))

# define the network prediction
preds = nn.nn_p3p4p5(img_input,
                     offset=C.offset,
                     num_scale=C.num_scale,
                     trainable=True)
model = Model(img_input, preds)

if C.offset:
    w_path = 'output/valmodels/city_valMR/{}/off{}'.format(C.scale, exp_name)
    out_path = 'output/valresults/city_valMR/{}/off{}'.format(
        C.scale, exp_name)
if not os.path.exists(out_path):
    os.makedirs(out_path)

weight1 = os.path.join(w_path, 'best_val.hdf5')
res_path = os.path.join(out_path, 'best_val')
if not os.path.exists(res_path):
    os.makedirs(res_path)
print(res_path)