main
menyifang 2 years ago
parent cf416a632f
commit a9ccb3d0c9

BIN
.DS_Store vendored

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 MiB

After

Width:  |  Height:  |  Size: 42 MiB

@ -0,0 +1,201 @@
Beyoncé
Taylor Swift
Rihanna
Ariana Grande
Angelina Jolie
Jennifer Lawrence
Emma Watson
Katy Perry
Scarlett Johansson
Lady Gaga
Gal Gadot
Selena Gomez
Sandra Bullock
Ellen DeGeneres
Mila Kunis
Jennifer Aniston
Margot Robbie
Blake Lively
Miley Cyrus
Charlize Theron
Emma Stone
Sofia Vergara
Halle Berry
Zendaya
Dwayne Johnson
Lady Amelia Windsor
Brie Larson
Adele
Janelle Monae
Shakira
Priyanka Chopra
Betty White
Nina Dobrev
Meghan Markle
Lupita Nyong'o
Emilia Clarke
Kate Middleton
Zooey Deschanel
Sienna Miller
Christina Aguilera
Kate Hudson
Gina Rodriguez
Cardi B
Yara Shahidi
Michelle Obama
Kourtney Kardashian
Portia de Rossi
Kerry Washington
Jada Pinkett Smith
Lucy Liu
Victoria Beckham
Gwyneth Paltrow
Kim Kardashian
Ellen Page
Kerry Washington
Maya Rudolph
Alicia Keys
Oprah Winfrey
Tracee Ellis Ross
Jennifer Lopez
Rachel McAdams
Pink
Cameron Diaz
Lily Collins
Anne Hathaway
Tyra Banks
Ashley Tisdale
Amanda Seyfried
Jessica Alba
Demi Lovato
Keira Knightley
Bella Hadid
Kendall Jenner
Emma Roberts
Vanessa Hudgens
Sofia Richie
Hailey Bieber
Gisele Bündchen
Taylor Hill
Kiki Layne
Cate Blanchett
Kate Winslet
Gal Gadot
Salma Hayek
Julia Roberts
Mariah Carey
Scarlett Johansson
Rosie Huntington-Whitely
Marjane Satrapi
Halle Berry
Mariah Carey
Selena Gomez
Emma Watson
Jennifer Aniston
Rihanna
Blake Lively
Ariana Grande
Angelina Jolie
Lady Gaga
Taylor Swift
Robert Downey Jr.
Tom Cruise
George Clooney
Brad Pitt
Dwayne Johnson
Leonardo DiCaprio
Will Smith
Johnny Depp
Chris Evans
Ryan Reynolds
Tom Hanks
Matt Damon
Denzel Washington
Hugh Jackman
Chris Hemsworth
Chris Pratt
Idris Elba
Daniel Craig
Samuel L. Jackson
Jeremy Renner
Chris Pine
Robert Pattinson
Sebastian Stan
Benedict Cumberbatch
Paul Rudd
Mark Wahlberg
Zac Efron
Jason Statham
Michael Fassbender
Joel Kinnaman
Keanu Reeves
Scarlett Johansson
Vin Diesel
Angelina Jolie
Emma Watson
Jennifer Lawrence
Gal Gadot
Margot Robbie
Brie Larson
Sofia Vergara
Mila Kunis
Emily Blunt
Sandra Bullock
Kate Winslet
Nicole Kidman
Charlize Theron
Anne Hathaway
Cate Blanchett
Emma Stone
Lupita Nyong'o
Jennifer Aniston
Halle Berry
Rihanna
Lady Gaga
Beyoncé
Taylor Swift
Miley Cyrus
Ariana Grande
Meghan Markle
Kate Middleton
Angelina Jolie
Jennifer Lopez
Shakira
Katy Perry
Lady Gaga
Britney Spears
Adele
Mariah Carey
Madonna
Janet Jackson
Whitney Houston
Tina Turner
Celine Dion
Barbra Streisand
Cher
Gloria Estefan
Diana Ross
Julie Andrews
Liza Minnelli
Bette Midler
Elton John
Freddie Mercury
Paul McCartney
Elvis Presley
Michael Jackson
Prince
Madonna
Mariah Carey
Janet Jackson
Whitney Houston
Tina Turner
Celine Dion
Barbra Streisand
Cher
Gloria Estefan
Diana Ross
Julie Andrews
Liza Minnelli
Bette Midler
Elton John

@ -1,4 +1,13 @@
from modelscope.hub.snapshot_download import snapshot_download
# pre-trained models in different style
model_dir = snapshot_download('damo/cv_unet_person-image-cartoon_compound-models', cache_dir='.')
model_dir = snapshot_download('damo/cv_unet_person-image-cartoon-3d_compound-models', cache_dir='.')
model_dir = snapshot_download('damo/cv_unet_person-image-cartoon-handdrawn_compound-models', cache_dir='.')
model_dir = snapshot_download('damo/cv_unet_person-image-cartoon-sketch_compound-models', cache_dir='.')
model_dir = snapshot_download('damo/cv_unet_person-image-cartoon-artstyle_compound-models', cache_dir='.')
# pre-trained models trained with DCT-Net + Stable-Diffusion
model_dir = snapshot_download('damo/cv_unet_person-image-cartoon-sd-design_compound-models', revision='v1.0.0', cache_dir='.')
model_dir = snapshot_download('damo/cv_unet_person-image-cartoon-sd-illustration_compound-models', revision='v1.0.0', cache_dir='.')

@ -0,0 +1,59 @@
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
import torch
import os, cv2
import argparse
def load_cele_txt(celeb_file='celeb.txt'):
celeb = open(celeb_file, 'r')
lines = celeb.readlines()
name_list = []
for line in lines:
name = line.strip('\n')
if name != '':
name_list.append(name)
return name_list
def main(args):
style = args.style
repeat_num = 5
model_id = 'damo/cv_cartoon_stable_diffusion_' + style
pipe = pipeline(Tasks.text_to_image_synthesis, model=model_id,
model_revision='v1.0.0', torch_dtype=torch.float16)
from diffusers.schedulers import EulerAncestralDiscreteScheduler
pipe.pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.pipeline.scheduler.config)
print('model init finished!')
save_dir = 'res_style_%s/syn_celeb' % (style)
if not os.path.exists(save_dir):
os.makedirs(save_dir)
name_list = load_cele_txt('celeb.txt')
person_num = len(name_list)
for i in range(person_num):
name = name_list[i]
print('process %s' % name)
if style == "clipart":
prompt = 'archer style, a portrait painting of %s' % (name)
else:
prompt = 'sks style, a painting of a %s, no text' % (name)
images = pipe({'text': prompt, 'num_images_per_prompt': repeat_num})['output_imgs']
idx = 0
for image in images:
outpath = os.path.join(save_dir, '%s_%d.png' % (name, idx))
cv2.imwrite(outpath, image)
idx += 1
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--style', type=str, default='clipart')
args = parser.parse_args()
main(args)

@ -3,9 +3,49 @@ from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
##### DCT-Net
## anime style
img_cartoon = pipeline(Tasks.image_portrait_stylization,
model='damo/cv_unet_person-image-cartoon_compound-models')
result = img_cartoon('input.png')
cv2.imwrite('result_anime.png', result[OutputKeys.OUTPUT_IMG])
## 3d style
img_cartoon = pipeline(Tasks.image_portrait_stylization,
model='damo/cv_unet_person-image-cartoon-3d_compound-models')
result = img_cartoon('input.png')
cv2.imwrite('result_3d.png', result[OutputKeys.OUTPUT_IMG])
## handdrawn style
img_cartoon = pipeline(Tasks.image_portrait_stylization,
model='damo/cv_unet_person-image-cartoon-handdrawn_compound-models')
result = img_cartoon('input.png')
cv2.imwrite('result_handdrawn.png', result[OutputKeys.OUTPUT_IMG])
## sketch style
img_cartoon = pipeline(Tasks.image_portrait_stylization,
model='damo/cv_unet_person-image-cartoon-sketch_compound-models')
result = img_cartoon('input.png')
cv2.imwrite('result_sketch.png', result[OutputKeys.OUTPUT_IMG])
## artstyle style
img_cartoon = pipeline(Tasks.image_portrait_stylization,
model='damo/cv_unet_person-image-cartoon-artstyle_compound-models')
result = img_cartoon('input.png')
cv2.imwrite('result_artstyle.png', result[OutputKeys.OUTPUT_IMG])
#### DCT-Net + SD
## design style
img_cartoon = pipeline(Tasks.image_portrait_stylization,
model='damo/cv_unet_person-image-cartoon-sd-design_compound-models')
result = img_cartoon('input.png')
cv2.imwrite('result_sd_design.png', result[OutputKeys.OUTPUT_IMG])
## illustration style
img_cartoon = pipeline(Tasks.image_portrait_stylization,
model='damo/cv_unet_person-image-cartoon-sd-illustration_compound-models')
result = img_cartoon('input.png')
cv2.imwrite('result_sd_illustration.png', result[OutputKeys.OUTPUT_IMG])
cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG])
print('finished!')

Loading…
Cancel
Save