Giter VIP home page Giter VIP logo

torchsketch's Introduction

TorchSketch

PyPI

TorchSketch is an open source software library for free-hand sketch oriented deep learning research, which is built on the top of PyTorch.

The project is under continuous update!

1. Installation

TorchSketch is developed based on Python 3.7.

To avoid any conflicts with your existing Python setup, it's better to install TorchSketch into a standalone environment, e.g., an Anaconda virtual environment.

Assume that you have installed Anaconda. Please create a virtual environment before installation of TorchSketch, as follows.

# Create a virtual environment in Anaconda.
conda create --name ${CUSTOMIZED_ENVIRONMENT_NAME} python=3.7

# Activate it.
conda activate ${CUSTOMIZED_ENVIRONMENT_NAME}

1.1 Using pip

Please use the following command to install TorchSketch.

pip install torchsketch

Then, TorchSketch can be imported into your Python console as follows.

import torchsketch

If you are using MacOS, you may need cairo and pango installed. You can install them with homebrew

brew install cairo
brew install pango

1.2 From Source

In addition, TorchSketch also can be installed from source.

# Choose your workspace and download this repository.
cd ${CUSTOMIZED_WORKSPACE}
git clone https://github.com/PengBoXiangShang/torchsketch

# Enter the folder of TorchSketch.
cd torchsketch

# Install.
python setup.py install

2. Major Modules and Features of TorchSketch

2.1 Major Modules

TorchSketch has three main modules, including data, networks, utils, as shown in follows. The documents and example codes are provided in docs.

  • torchsketch
    • data
      • dataloaders: provides the dataloader class files for the frequently-used sketch datasets, e.g., TU-Berlin, Sketchy, QuickDraw.
      • datasets: provides the specific API for each dataset, which integrates a series of functions including downloading, extraction, cleaning, MD5 checksum, and other preprocessings.
    • networks
      • cnn: provides all the SOTA CNNs.
      • gnn: provides the sketch-applicable implementations of GNNs, including GCN, GAT, graph transformer, etc.
      • rnn: provides the sketch-applicable implementations of RNNs.
      • tcn: provides the sketch-applicable implementations of TCNs.
    • utils
      • data_augmentation_utils
      • general_utils
      • metric_utils
      • self_supervised_utils
      • svg_specific_utils
    • docs
      • api_reference
      • examples

These modules and sub-modules can be imported as follows.

import torchsketch.data.dataloaders as dataloaders
import torchsketch.data.datasets as datasets

import torchsketch.networks.cnn as cnns
import torchsketch.networks.gnn as gnns
import torchsketch.networks.rnn as rnns
import torchsketch.networks.tcn as tcns

import torchsketch.utils.data_augmentation_utils as data_augmentation_utils
import torchsketch.utils.general_utils as general_utils
import torchsketch.utils.metric_utils as metric_utils
import torchsketch.utils.self_supervised_utils as self_supervised_utils
import torchsketch.utils.svg_specific_utils as svg_specific_utils

As shown in the following figure, a general PyTorch-based code project mainly includes four blocks, i.e., preparing data, preparing data loader, creating network/model, and training. The functions/APIs built-in torchsketch.utils are designed orienting at all four blocks. When researchers would prepare data and data loader, they could select functions/APIs from torchsketch.data. When researchers would create a network, they could select network classes from torchsketch.networks.

2.2 Major Features

  • TorchSketch supports both GPU based and Python built-in multi-processing acceleration.
  • TorchSketch is modular, flexible, and extensible, without overly complex design patterns and excessive encapsulation.
  • TorchSketch provides four kinds of network architectures that are applicable to sketch, i.e., CNN, RNN, GNN, TCN.
  • TorchSketch is compatible to not only numerous datasets but also various formats of free-hand sketch, e.g., SVG, NumPy, PNG, JPEG, by providing numerous format-convert APIs, format-specific APIs, etc.
  • TorchSketch supports self-supervised learning study for sketch.
  • TorchSketch, beyond free-hand sketch research, also has some universal components that are applicable to the studies for other deep learning topics.

Citations

If you find this code useful, please cite our paper "Deep Learning for Free-Hand Sketch: A Survey" (https://arxiv.org/abs/2001.02600):

License

This project is licensed under the MIT License

torchsketch's People

Contributors

pengboxiangshang avatar songyzh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

torchsketch's Issues

sketchanet is not found.

Thank you so much for this great repo!
I install the repo by pip,but I found sketchanet python file is lost in network.cnn.

what are coordinate files?

I downloaded the quickdraw data using torchsketch.
(torchsketch.data.datasets.quickdraw.quickdraw_414k.download_quickdraw_414k.py)

The downloaded folder was as follows.

  1. picture_files
  2. coordinate_files

Of these two, "2. coordinate_files" were difficult to understand.
The format was "npy" and when printed through "np.load", the results were as follows.

  • print(data) :
    [[ 0. 246. 1. 0.]
    [ 25. 186. 1. 0.]
    [ 63. 120. 1. 0.]
    [ 81. 83. 1. 0.]
    [101. 37. 1. 0.]
    ...
    [-1, -1, -1, -1]
    ...
    [-1, -1, -1, -1]]

  • print(data.shape) :
    (100, 4)

Can you explain each [a, b, c, d] here?
(e.g. [0, 246, 1, 0])

Training examples

Coule you provide some training/testing scripts to demonstrate practical usage? -- reproduce results in the survey

It seems that the project is still under development, am i right? If so, may be better to have a roadmap to let people know which modules are done and which parts are currently unstable.

No matching distribution found for torchvision==0.4.0

I can't install torchsketch library cause of torchvision requested version is unavailable.
can you update the project requirements?

ERROR: Could not find a version that satisfies the requirement torchvision==0.4.0 (from torchsketch) (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3, 0.8.2, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1)
ERROR: No matching distribution found for torchvision==0.4.0

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.