From f207e39c12df0229808b509b6c9d05f0345b95ae Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Sun, 15 Jan 2023 12:40:35 +0100 Subject: [PATCH] Added method outline --- .editorconfig | 3 +++ main.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .editorconfig create mode 100644 main.py diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c563ce --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.py] +indent_style = space +indent-size=2 \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..5664300 --- /dev/null +++ b/main.py @@ -0,0 +1,35 @@ +# Allows imports from the style transfer submodule +import sys +sys.path.append('DCT-Net') + +import cv2 +import os +import numpy as np + +from source.cartoonize import Cartoonizer + + +def load_source(filename: str) -> np.ndarray: + return cv2.imread(filename)[...,::-1] + + +def find_and_crop_face(data: np.ndarray) -> np.ndarray: + # TODO + return data + + +def compare_with_anime_characters(data: np.ndarray) -> int: + # TODO + return 1 + + +def transfer_to_anime(ima: np.ndarray): + algo = Cartoonizer(dataroot='damo/cv_unet_person-image-cartoon_compound-models') + return algo.cartoonize(img) + + +if __name__ == '__main__': + source = load_source('input.png') + source_face = find_and_crop_face(source) + source_face_anime = transfer_to_anime(source) + print(compare_with_anime_characters(source_face_anime))