feat sketch 提取接口

fix
This commit is contained in:
zhouchengrong
2024-08-14 17:13:47 +08:00
parent 2505c55bfd
commit 90d8b47884
2 changed files with 10 additions and 3 deletions

View File

@@ -1,10 +1,13 @@
from app.core.config import DEBUG
class Config:
def __init__(self):
# 基本参数
self.dataroot = "service/image2sketch/datasets/ref_unpair"
self.dataroot = "app/service/image2sketch/datasets/ref_unpair"
self.name = 'semi_unpair'
self.gpu_ids = [0]
self.checkpoints_dir = 'service/image2sketch/checkpoints/'
self.checkpoints_dir = 'app/service/image2sketch/checkpoints/'
# 模型参数
self.model = 'unpaired'
self.input_nc = 3
@@ -43,3 +46,7 @@ class Config:
self.eval = False
self.num_test = 1000
self.morm = 'batch'
if DEBUG:
self.style_image = "service/image2sketch/datasets/ref_unpair/testC/20180422151845_stEe4.jpeg"
else:
self.style_image = "app/service/image2sketch/datasets/ref_unpair/testC/20180422151845_stEe4.jpeg"

View File

@@ -47,7 +47,7 @@ class Image2SketchServer:
self.model.setup(self.opt)
transform_list = [transforms.ToTensor(), transforms.Normalize([0.5], [0.5])]
transform = transforms.Compose(transform_list)
style_img = Image.open(r"E:\workspace\trinity_client_aida\app\service\image2sketch\datasets\ref_unpair\testC\20180422151845_stEe4.jpeg").convert('L')
style_img = Image.open(self.opt.style_image).convert('L')
style_img = transform(style_img)
self.data['B'] = style_img
self.data['B'] = self.data['B'].unsqueeze(0).to(device)