mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +08:00

* 第一次提交 * 补充一处漏翻译 * deleted: docs/en/quantize.md * Update one translation * Update en version * Update one translation in code * Standardize one writing * Standardize one writing * Update some en version * Fix a grammer problem * Update en version for api/vision result * Merge branch 'develop' of https://github.com/charl-u/FastDeploy into develop * Checkout the link in README in vision_results/ to the en documents * Modify a title * Add link to serving/docs/ * Finish translation of demo.md * Update english version of serving/docs/ * Update title of readme * Update some links * Modify a title * Update some links * Update en version of java android README * Modify some titles * Modify some titles * Modify some titles * modify article to document * update some english version of documents in examples * Add english version of documents in examples/visions * Sync to current branch * Add english version of documents in examples * Add english version of documents in examples * Add english version of documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples
English | 简体中文
AnimeGAN Python Deployment Example
Two steps before deployment
-
- Software and hardware should meet the requirements. Please refer to FastDeploy Environment Requirements
-
- Install FastDeploy Python whl package. Refer to FastDeploy Python Installation
This directory provides examples that infer.py
fast finishes the deployment of AnimeGAN on CPU/GPU and GPU accelerated by TensorRT. The script is as follows
# Download the example code for deployment
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy/examples/vision/generation/anemigan/python
# Download prepared test images
wget https://bj.bcebos.com/paddlehub/fastdeploy/style_transfer_testimg.jpg
# CPU inference
python infer.py --model animegan_v1_hayao_60 --image style_transfer_testimg.jpg --device cpu
# GPU inference
python infer.py --model animegan_v1_hayao_60 --image style_transfer_testimg.jpg --device gpu
AnimeGAN Python Interface
fd.vision.generation.AnimeGAN(model_file, params_file, runtime_option=None, model_format=ModelFormat.PADDLE)
AnimeGAN model loading and initialization, among which model_file and params_file are the model file and parameter file for Paddle inference.
Parameter
- model_file(str): Model file path
- params_file(str): Parameter file path
- runtime_option(RuntimeOption): Backend inference configuration. None by default, which is the default configuration
- model_format(ModelFormat): Model format. PADDLE format by default
predict function
AnimeGAN.predict(input_image)
Model prediction interface. Input images and output style transfer results.
Parameter
- input_image(np.ndarray): Input data in HWC or BGR format
Return np.ndarray, the image after style transfer in BGR format
batch_predict function
AnimeGAN.batch_predict function (input_images)
Model prediction interface. Input a set of images and output style transfer results
Parameter
- input_images(list(np.ndarray)): Input data in HWC or BGR format
Return list(np.ndarray), a set of images after style transfer in BGR format