args.gpu = -1 args.win_size = int(args.win_size / 4.0) * 4 # make sure the width of the image can be divided by 4 if args.backend == 'caffe': # initialize the colorization model colorModel = CI.ColorizeImageCaffe(Xd=args.load_size) colorModel.prep_net(args.gpu, args.color_prototxt, args.color_caffemodel) distModel = CI.ColorizeImageCaffeDist(Xd=args.load_size) distModel.prep_net(args.gpu, args.dist_prototxt, args.dist_caffemodel) elif args.backend == 'pytorch': colorModel = CI.ColorizeImageTorch(Xd=args.load_size,maskcent=args.pytorch_maskcent) colorModel.prep_net(path=args.color_model) distModel = CI.ColorizeImageTorchDist(Xd=args.load_size,maskcent=args.pytorch_maskcent) distModel.prep_net(path=args.color_model, dist=True) else: print('backend type [%s] not found!' % args.backend) # initialize application app = QApplication(sys.argv) window = gui_design.GUIDesign(color_model=colorModel, dist_model=distModel, img_file=args.image_file, load_size=args.load_size, win_size=args.win_size) app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False)) # comment this if you do not like dark stylesheet app.setWindowIcon(QIcon('imgs/logo.png')) # load logo window.setWindowTitle('iColor') window.setWindowFlags(window.windowFlags() & ~Qt.WindowMaximizeButtonHint) # fix window siz window.show() app.exec_()
args.win_size / 4.0) * 4 # make sure the width of the image can be divided by 4 if (args.backend == 'caffe'): # initialize the colorization model colorModel = CI.ColorizeImageCaffe(Xd=args.load_size) colorModel.prep_net(args.gpu, args.color_prototxt, args.color_caffemodel) distModel = CI.ColorizeImageCaffeDist(Xd=args.load_size) distModel.prep_net(args.gpu, args.dist_prototxt, args.dist_caffemodel) elif (args.backend == 'pytorch'): colorModel = CI.ColorizeImageTorch(Xd=args.load_size) colorModel.prep_net(path=args.color_model) distModel = CI.ColorizeImageTorchDist(Xd=args.load_size) distModel.prep_net(path=args.color_model, dist=True) else: print('backend type [%s] not found!' % args.backend) # initialize application app = QApplication(sys.argv) window = gui_design.GUIDesign(color_model=colorModel, dist_model=distModel, img_file=args.image_file, load_size=args.load_size, win_size=args.win_size) app.setStyleSheet(qdarkstyle.load_stylesheet( pyside=False)) # comment this if you do not like dark stylesheet app.setWindowIcon(QIcon('imgs/logo.png')) # load logo window.setWindowTitle('iColor')