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))
from keras.models import Model from eval_city.dt_txt2json import convert_file from eval_city.eval_script.coco import COCO from eval_city.eval_script.eval_MR_multisetup import COCOeval from keras_csp import config, bbox_process from keras_csp.utilsfunc import * # parse experiment name if len(sys.argv) == 1: exp_name = '' else: exp_name = '_{}'.format(sys.argv[1]) os.environ["CUDA_VISIBLE_DEVICES"] = '0' C = config.Config() C.offset = True cache_path = 'data/cache/cityperson/val_500' with open(cache_path, 'rb') as fid: val_data = cPickle.load(fid) num_imgs = len(val_data) print('num of val samples: {}'.format(num_imgs)) 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':