def getModel(num_img, img_height, img_width, output_dim, weights_path): """ Initialize model. # Arguments img_width: Target image widht. img_height: Target image height. num_img: Target images per block output_dim: Dimension of model output (number of classes). weights_path: Path to pre-trained model. # Returns model: A Model instance. """ model = nets.resnet50(num_img, img_height, img_width, output_dim) if weights_path: try: model.load_weights(weights_path) print("Loaded model from {}".format(weights_path)) except: print("Impossible to find weight path. Returning untrained model") return model
plt.imshow(X0[0][i - 1]) plt.show() else: for i in range(1, columns * rows + 1): fig.add_subplot(rows, columns, i) if args['mode'] == 'Grey': plt.imshow(X0[i - 1][:, :, 0], cmap='gray') else: plt.imshow(X0[i - 1]) plt.show() # if args['mode'] == 'Grey': # model = get_model(args['mode'], n_sequence, n_output, dim, channels=1) # else: # model = get_model(args['mode'], n_sequence, n_output, dim, channels=3) single_model = resnet50(Input(shape=(64, 168, 64, 3)), num_classes=3) # model = MobileNetV3_Large((n_sequence, dim[0], dim[1], n_channels), n_output).build() # model = MobileNetV3_Small((n_sequence, dim[0], dim[1], n_channels), n_output).build() # model = ShuffleNetV2(input_shape = (n_sequence, dim[0], dim[1], n_channels), classes=n_output) # model = Effnet((n_sequence, dim[0], dim[1], n_channels), n_output) # model = iotnet3((16,96,96,3), 1, n=4, k=0.7) # Load weight of unfinish training model(optional) load_model = True start_epoch = 0 if load_model: weights_path = 'save_weight/weight-41-0.98-0.64-0.45690.hdf5' # name of model start_epoch = 41 single_model.load_weights(weights_path) # model = load_model(weights_path)