from nets.unet import mobilenet_unet model = mobilenet_unet(32, input_height=256, input_width=192) model.summary() # from nets.uunet import get_unet # model = get_unet(4,256,256) # model.summary() # # # from nets.unet1 import mobilenet_unet # model = mobilenet_unet(2,48,48) # model.summary()
import numpy as np import random import copy import os import cv2 random.seed(0) class_colors = [[0, 0, 0], [255, 0, 0], [255, 255, 0], [0, 255, 0], [0, 255, 255], [255, 255, 255], [255, 0, 255], [0, 0, 255], [0, 100, 200], [200, 100, 0]] NCLASSES = 10 HEIGHT = 256 WIDTH = 256 model = mobilenet_unet(n_classes=NCLASSES, input_height=HEIGHT, input_width=WIDTH) model.load_weights("logs/last1.h5") imgs = os.listdir("./img") for jpg in imgs: image = cv2.imread('./img/' + jpg) cv2.imwrite('./img/' + jpg[:-4] + '.png', image) img = Image.open("./img/" + jpg[:-4] + '.png') old_img = copy.deepcopy(img) orininal_h = np.array(img).shape[0] orininal_w = np.array(img).shape[1] img = img.resize((WIDTH, HEIGHT))
#---------------------------------------------# # 该部分用于查看网络结构 #---------------------------------------------# from nets.unet import mobilenet_unet if __name__ == "__main__": model = mobilenet_unet(2, 416, 416) model.summary()