Skip to content

Latest commit

 

History

History
95 lines (63 loc) · 2.43 KB

File metadata and controls

95 lines (63 loc) · 2.43 KB

Photo2Cartoon

Module Name Photo2Cartoon
Category image generation
Network U-GAT-IT
Dataset cartoon_data
Fine-tuning supported or not No
Module Size 205MB
Latest update date 2021-02-26
Data indicators -

I.Basic Information

  • Application Effect Display

    • Sample results:


  • Module Introduction

II.Installation

III.Module API Prediction

  • 1、Prediction Code Example

    • import paddlehub as hub
      import cv2
      
      model = hub.Module(name="Photo2Cartoon")
      result = model.Cartoon_GEN(images=[cv2.imread('/PATH/TO/IMAGE')])
      # or
      # result = model.Cartoon_GEN(paths=['/PATH/TO/IMAGE'])
  • 2、API

    • def Cartoon_GEN(images=None,
                      paths=None,
                      batch_size=1,
                      output_dir='output',
                      visualization=False,
                      use_gpu=False):
      • Cartoon style generation API.

      • Parameters

        • images (list[numpy.ndarray]): image data, ndarray.shape is in the format [H, W, C], BGR;
        • paths (list[str]): image path;
        • output_dir (str): save path of images;
        • batch_size (int): the size of batch;
        • visualization (bool): Whether to save the results as picture files;
        • use_gpu (bool): use GPU or not; set the CUDA_VISIBLE_DEVICES environment variable first if you are using GPU

        NOTE: choose one parameter to provide data from paths and images

      • Return

        • res (list[numpy.ndarray]): result list,ndarray.shape is [H, W, C]

IV.Release Note

  • 1.0.0

    First release

    • $ hub install Photo2Cartoon==1.0.0