Giter Site home page Giter Site logo

chen-anp / paddleimagestyletransfer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from duolabmeng6/paddleimagestyletransfer

0.0 0.0 0.0 266 KB

一键部署图像风格迁移(宫崎骏)

Shell 17.42% JavaScript 1.90% Python 53.67% HTML 24.88% Dockerfile 2.13%

paddleimagestyletransfer's Introduction

基于 Serverless 图像转换为宫崎骏动漫风格案例

大家可以通过本项目提供的镜像,快速发布成可调用的Restful API服务。

animegan_v2_hayao_99

使用模型 animegan_v2_hayao_99

模型名称 animegan_v2_hayao_99
类别 图像 - 图像生成
网络 AnimeGAN
数据集 The Wind Rises
是否支持Fine-tuning
模型大小 9.4MB
最新更新日期 2021-07-30
数据指标 -

一、模型基本信息

  • 应用效果展示

    • 样例结果示例:


      输入图像

      输出图像

  • 模型介绍

    • AnimeGAN V2 图像风格转换模型, 模型可将输入的图像转换成宫崎骏动漫风格,模型权重转换自AnimeGAN V2官方开源项目

部署方法

1. 在阿里云函数计算应用中心里立即创建

阿里云Serverless 应用中心一键体验

2. 终端上输入命令创建

s init paddleImageStyleTransfer  # 初始化项目
s deploy  # 部署项目

调用方法

import requests
import json
import cv2
import base64


def cv2_to_base64(image):
    data = cv2.imencode('.jpg', image)[1]
    return base64.b64encode(data.tostring()).decode('utf8')


def getResult(imagePath):
    data = json.dumps({'images': [cv2_to_base64(cv2.imread(imagePath))]})
    r = requests.post("http://127.0.0.1:9000/predict/animegan_v2_hayao_99", data=data,
                      headers={'Content-Type': 'application/json'})
    return r.json()["results"]


print(getResult("./test.png"))

调用失败的请看这里

  • 500x300 分辨率 需要 7秒 2.6gb内存 所以函数设置 3gb 运行内存才可以
  • 720x500 分辨率 需要 15秒 5.76gb内存 所以函数设置 8gb 运行内存才可以
  • 2000x1280 分辨率 需要 30秒 6.77g内存 所以设置 8gb 运行内存才可以

我是直接设置了16gb内存测试的

本应用的镜像开发教程

https://github.com/duolabmeng6/paddlehub_ppocr

阅读本文你将学会:

在 Serverless 架构中 docker 镜像制作的最佳实践,游刃有余的部署复杂场景下的深度学习模型

熟练的使用各厂商提供的 Serverless 服务,部署。

制作小巧精良的 docker 镜像

常用命令

s cli registry login # 登录授权 一次就行
s cli registry publish # 发布包
s cli registry list # 查看子机已发布的包

s init paddleImageStyleTransfer # 自己测试应用的效果
s deploy # 部署项目试试

paddleimagestyletransfer's People

Contributors

chen-anp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.