Giter VIP home page Giter VIP logo

pt2tfjs's Introduction

PyTorch to TensorFlow.js

한국어 버전의 설명은 여기를 참고하시기 바랍니다.

Introduction

This repository provides code to convert PyTorch models to TensorFlow.js (TFJS). The overall process involves converting the model in the following order: PyTorch -> ONNX -> TensorFlow -> TensorFlow.js.

Requirements Installation

# requirements.txt
pip install -r requirements.txt

# timm package install
pip install git+https://github.com/rwightman/pytorch-image-models.git

Converting Process

  • PyTorch - ONNX - TensorFlow - TensorFlow.js

Usage

File Tree

Let's assume that the trained PyTorch model is inside the outputs folder with the following file tree structure:

pt2tfjs (repository)
├── src
└── outputs
    └── ${ModelName}
        ├── ${ModelName}.pt
        └── ${ModelName}.json

Execution

For the -n option, you only need to provide the name of the folder containing the model inside the outputs folder.

python3 src/pt2tfjs.py -n ${ModelName}

Acknowledgement

  • models/pplcnet.py code is slightly changed from PP-LCNet.

pt2tfjs's People

Contributors

ljm565 avatar

Watchers

Kostas Georgiou avatar  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.