提交 480fea7b 编写于 作者: H HypoX64

Fix training part #5

上级 9cb4eb05
......@@ -50,7 +50,7 @@ class Options():
self.initialized = True
def getparse(self):
def getparse(self, test_flag = False):
if not self.initialized:
self.initialize()
self.opt = self.parser.parse_args()
......@@ -65,6 +65,7 @@ class Options():
else:
self.opt.use_gpu = -1
if test_flag:
if not os.path.exists(self.opt.media_path):
print('Error: Bad media path!')
input('Please press any key to exit.\n')
......
......@@ -5,7 +5,7 @@ from cores import Options,core
from util import util
from models import loadmodel
opt = Options().getparse()
opt = Options().getparse(test_flag = True)
util.file_init(opt)
def main():
......
......@@ -106,7 +106,13 @@ for fold in range(opt.fold):
# t.start()
saveflag = True
x,y,size,area = impro.boundingSquare(mask, random.uniform(1.4,1.6))
if opt.mod == ['drawn','irregular']:
x,y,size,area = impro.boundingSquare(mask_drawn, random.uniform(1.2,1.6))
elif opt.mod == ['network','irregular']:
x,y,size,area = impro.boundingSquare(mask_net, random.uniform(1.2,1.6))
else:
x,y,size,area = impro.boundingSquare(mask, random.uniform(1.2,1.6))
if area < 1000:
saveflag = False
else:
......
......@@ -10,6 +10,8 @@ import datetime
import time
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import cv2
......
......@@ -16,6 +16,8 @@ from multiprocessing import Process, Queue
from util import mosaic,util,ffmpeg,filt,data
from util import image_processing as impro
from models import pix2pix_model,pix2pixHD_model,video_model,unet_model,loadmodel,videoHD_model
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import torch.backends.cudnn as cudnn
......
......@@ -79,7 +79,7 @@ def ch_one2three(img):
res = cv2.merge([img, img, img])
return res
def color_adjust(img,alpha=1,beta=0,b=0,g=0,r=0,ran = False):
def color_adjust(img,alpha=0,beta=0,b=0,g=0,r=0,ran = False):
'''
g(x) = (1+α)g(x)+255*β,
g(x) = g(x[:+b*255,:+g*255,:+r*255])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册