comparison #3
11
main.py
11
main.py
@ -1,16 +1,15 @@
|
|||||||
# Allows imports from the style transfer submodule
|
|
||||||
import sys
|
import sys
|
||||||
sys.path.append('DCT-Net')
|
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import os
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
# Allows imports from the style transfer submodule
|
||||||
|
sys.path.append('DCT-Net')
|
||||||
|
|
||||||
from source.cartoonize import Cartoonizer
|
from source.cartoonize import Cartoonizer
|
||||||
|
|
||||||
|
|
||||||
def load_source(filename: str) -> np.ndarray:
|
def load_source(filename: str) -> np.ndarray:
|
||||||
return cv2.imread(filename)[...,::-1]
|
return cv2.imread(filename)[..., ::-1]
|
||||||
|
|
||||||
|
|
||||||
def find_and_crop_face(data: np.ndarray) -> np.ndarray:
|
def find_and_crop_face(data: np.ndarray) -> np.ndarray:
|
||||||
@ -29,7 +28,7 @@ def compare_with_anime_characters(data: np.ndarray) -> int:
|
|||||||
|
|
||||||
|
|
||||||
def transfer_to_anime(img: np.ndarray):
|
def transfer_to_anime(img: np.ndarray):
|
||||||
algo = Cartoonizer(dataroot='damo/cv_unet_person-image-cartoon_compound-models')
|
algo = Cartoonizer(dataroot='DCT-Net/damo/cv_unet_person-image-cartoon_compound-models')
|
||||||
return algo.cartoonize(img)
|
return algo.cartoonize(img)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,3 +6,4 @@ requests==2.28.2
|
|||||||
beautifulsoup4==4.11.1
|
beautifulsoup4==4.11.1
|
||||||
lxml==4.9.2
|
lxml==4.9.2
|
||||||
opencv-python==4.7.0.68
|
opencv-python==4.7.0.68
|
||||||
|
torch==1.13.1
|
Loading…
Reference in New Issue
Block a user