{"id":13560545,"url":"https://github.com/PengBoXiangShang/torchsketch","last_synced_at":"2025-04-03T16:30:47.041Z","repository":{"id":44628237,"uuid":"246229080","full_name":"PengBoXiangShang/torchsketch","owner":"PengBoXiangShang","description":"TPAMI 2022","archived":false,"fork":false,"pushed_at":"2020-10-11T15:57:28.000Z","size":119,"stargazers_count":183,"open_issues_count":1,"forks_count":21,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-24T05:57:33.663Z","etag":null,"topics":["cnn","deep-learning","gnn","pytorch","rnn","sketch","tcn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PengBoXiangShang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-10T06:55:12.000Z","updated_at":"2025-02-27T07:28:51.000Z","dependencies_parsed_at":"2022-07-15T11:00:30.576Z","dependency_job_id":null,"html_url":"https://github.com/PengBoXiangShang/torchsketch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PengBoXiangShang%2Ftorchsketch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PengBoXiangShang%2Ftorchsketch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PengBoXiangShang%2Ftorchsketch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PengBoXiangShang%2Ftorchsketch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PengBoXiangShang","download_url":"https://codeload.github.com/PengBoXiangShang/torchsketch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246892847,"owners_count":20850850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cnn","deep-learning","gnn","pytorch","rnn","sketch","tcn"],"created_at":"2024-08-01T13:00:46.304Z","updated_at":"2025-04-03T16:30:47.021Z","avatar_url":"https://github.com/PengBoXiangShang.png","language":"Python","funding_links":[],"categories":["Code and Framework"],"sub_categories":[],"readme":"# TorchSketch\r\n[![PyPI](https://img.shields.io/pypi/v/torchsketch)](https://pypi.org/project/torchsketch/) ![](https://img.shields.io/badge/language-Python-{green}.svg) ![](https://img.shields.io/npm/l/express.svg)\r\n\r\n\u003cdiv align=center\u003e\u003cimg src=\"https://github.com/PengBoXiangShang/torchsketch/blob/master/torchsketch/docs/others/torchsketch.gif\"/\u003e\u003c/div\u003e\r\n\r\nTorchSketch is an open source software library for free-hand sketch oriented deep learning research, which is built on the top of [PyTorch](https://pytorch.org/).\r\n\r\n**The project is under continuous update!**\r\n\r\n\r\n\r\n## 1. Installation\r\nTorchSketch is developed based on Python 3.7.\r\n\r\nTo avoid any conflicts with your existing Python setup, it's better to install TorchSketch into a standalone environment, e.g., an Anaconda virtual environment.\r\n\r\nAssume that you have installed Anaconda. Please create a virtual environment before installation of TorchSketch, as follows.\r\n```bash\r\n# Create a virtual environment in Anaconda.\r\nconda create --name ${CUSTOMIZED_ENVIRONMENT_NAME} python=3.7\r\n\r\n# Activate it.\r\nconda activate ${CUSTOMIZED_ENVIRONMENT_NAME}\r\n```\r\n\r\n### 1.1 Using pip\r\nPlease use the following command to install TorchSketch. \r\n```bash\r\npip install torchsketch\r\n```\r\nThen, TorchSketch can be imported into your Python console as follows.\r\n```python\r\nimport torchsketch\r\n```\r\nIf you are using MacOS, you may need ***cairo*** and ***pango*** installed. You can install them with [homebrew](https://brew.sh/)\r\n```bash\r\nbrew install cairo\r\nbrew install pango\r\n```\r\n\r\n### 1.2 From Source\r\nIn addition, TorchSketch also can be installed from source.\r\n```bash\r\n# Choose your workspace and download this repository.\r\ncd ${CUSTOMIZED_WORKSPACE}\r\ngit clone https://github.com/PengBoXiangShang/torchsketch\r\n\r\n# Enter the folder of TorchSketch.\r\ncd torchsketch\r\n\r\n# Install.\r\npython setup.py install\r\n```\r\n\r\n\r\n## 2. Major Modules and Features of TorchSketch\r\n\r\n### 2.1 Major Modules\r\nTorchSketch has three main modules, including `data`, `networks`, `utils`, as shown in follows.\r\nThe documents and example codes are provided in `docs`.\r\n  - **torchsketch**\r\n    - **data**\r\n      - **dataloaders**: provides the dataloader class files for the frequently-used sketch datasets, e.g., TU-Berlin, Sketchy, QuickDraw.\r\n      - **datasets**: provides the specific API for each dataset, which integrates a series of functions including downloading, extraction, cleaning, MD5 checksum, and other preprocessings.\r\n    - **networks**\r\n      - **cnn**: provides all the SOTA CNNs.\r\n      - **gnn**: provides the sketch-applicable implementations of GNNs, including GCN, GAT, graph transformer, etc.\r\n      - **rnn**: provides the sketch-applicable implementations of RNNs.\r\n      - **tcn**: provides the sketch-applicable implementations of TCNs.\r\n    - **utils**\r\n      - **data_augmentation_utils**\r\n      - **general_utils**\r\n      - **metric_utils**\r\n      - **self_supervised_utils**\r\n      - **svg_specific_utils**\r\n    - **docs**\r\n      - **api_reference**\r\n      - **examples**\r\n\r\nThese modules and sub-modules can be imported as follows.\r\n```python\r\nimport torchsketch.data.dataloaders as dataloaders\r\nimport torchsketch.data.datasets as datasets\r\n\r\nimport torchsketch.networks.cnn as cnns\r\nimport torchsketch.networks.gnn as gnns\r\nimport torchsketch.networks.rnn as rnns\r\nimport torchsketch.networks.tcn as tcns\r\n\r\nimport torchsketch.utils.data_augmentation_utils as data_augmentation_utils\r\nimport torchsketch.utils.general_utils as general_utils\r\nimport torchsketch.utils.metric_utils as metric_utils\r\nimport torchsketch.utils.self_supervised_utils as self_supervised_utils\r\nimport torchsketch.utils.svg_specific_utils as svg_specific_utils\r\n```\r\n\r\nAs 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.\r\n\u003cdiv align=center\u003e\u003cimg src=\"https://github.com/PengBoXiangShang/torchsketch/blob/master/torchsketch/docs/others/pseudo-code-figure.png\" width=\"70%\"/\u003e\u003c/div\u003e\r\n\r\n\r\n\r\n### 2.2 Major Features\r\n  - TorchSketch supports both GPU based and Python built-in multi-processing acceleration.\r\n  - TorchSketch is modular, flexible, and extensible, without overly complex design patterns and excessive encapsulation.\r\n  - TorchSketch provides four kinds of network architectures that are applicable to sketch, i.e., CNN, RNN, GNN, TCN.\r\n  - 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.\r\n  - TorchSketch supports self-supervised learning study for sketch.\r\n  - TorchSketch, beyond free-hand sketch research, also has some universal components that are applicable to the studies for other deep learning topics.\r\n\r\n\r\n## Citations\r\nIf you find this code useful, please cite our paper \"**Deep Learning for Free-Hand Sketch: A Survey**\" ([https://arxiv.org/abs/2001.02600](https://arxiv.org/abs/2001.02600)):\r\n\r\n\r\n## License\r\nThis project is licensed under the MIT License\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPengBoXiangShang%2Ftorchsketch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPengBoXiangShang%2Ftorchsketch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPengBoXiangShang%2Ftorchsketch/lists"}