diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pypi.yml similarity index 95% rename from .github/workflows/pythonpublish.yml rename to .github/workflows/pypi.yml index f167525a..4a019573 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pypi.yml @@ -4,9 +4,8 @@ name: Upload Python Package on: - push: - branches: - - master + schedule: + - cron: "0 12 * * *" jobs: deploy: diff --git a/.github/workflows/build_sphix_master.yml b/.github/workflows/sphix_build_master.yml similarity index 97% rename from .github/workflows/build_sphix_master.yml rename to .github/workflows/sphix_build_master.yml index adc53018..2bc2462d 100644 --- a/.github/workflows/build_sphix_master.yml +++ b/.github/workflows/sphix_build_master.yml @@ -47,5 +47,5 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - build_dir: "docs/build/html/*" + build_dir: docs/build/html/ target_branch: gh-pages diff --git a/.github/workflows/sphix_build_pr.yml b/.github/workflows/sphix_build_pr.yml index 5b171b9a..4cc3850e 100644 --- a/.github/workflows/sphix_build_pr.yml +++ b/.github/workflows/sphix_build_pr.yml @@ -9,16 +9,21 @@ on: jobs: docs: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v2 - uses: seanmiddleditch/gha-setup-ninja@master - - - name: Set up Python - uses: actions/setup-python@v1 + + - name: Set PR Number + uses: actions/github-script@0.3.0 with: - python-version: 3.7 - + github-token: ${{github.token}} + script: | + const core = require('@actions/core') + const prNumber = context.payload.number; + core.exportVariable('PULL_NUMBER', prNumber); + core.exportVariable("PATH", "/home/ubuntu/anaconda3/bin:/usr/local/bin:/usr/bin/:/bin:$PATH") + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -39,35 +44,11 @@ jobs: cd docs/ make html touch build/html/.nojekyll - - - name: Set PR Number - uses: actions/github-script@0.3.0 - with: - github-token: ${{github.token}} - script: | - const core = require('@actions/core') - const prNumber = context.payload.number; - core.exportVariable('PULL_NUMBER', prNumber); - - - # https://github.com/marketplace/actions/github-pages - - name: Deploy - if: success() - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read --follow-symlinks --delete - env: - AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} - DEST_DIR: "${{ secrets.DEST_DIR }}/${PULL_NUMBER}" - SOURCE_DIR: 'docs/build/html/' - + aws s3 sync build/html/ s3://hangzh/encoding/docs/${{ env.PULL_NUMBER }}/ --acl public-read --follow-symlinks --delete - name: Comment if: success() uses: thollander/actions-comment-pull-request@master with: - message: "The docs are uploaded and can be previewed at http://${{ secrets.AWS_S3_BUCKET }}.s3.amazonaws.com/${{ secrets.DEST_DIR }}/${{ env.PULL_NUMBER }}/index.html" + message: "The docs are uploaded and can be previewed at http://hangzh.s3.amazonaws.com/encoding/docs/${{ env.PULL_NUMBER }}/index.html" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index fc428944..cc0b4412 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ docs/src/ docs/html/ encoding/_ext/ encoding.egg-info/ +*.o +*.so +*.ninja* diff --git a/README.md b/README.md index 06851187..a4c9856e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ [![PyPI](https://img.shields.io/pypi/v/torch-encoding.svg)](https://pypi.python.org/pypi/torch-encoding) -[![PyPI Pre-release](https://img.shields.io/badge/pypi--prerelease-v1.1.0-ff69b4.svg)](https://pypi.org/project/torch-encoding/#history) +[![PyPI Pre-release](https://img.shields.io/badge/pypi--prerelease-v1.2.0-ff69b4.svg)](https://pypi.org/project/torch-encoding/#history) [![Upload Python Package](https://github.com/zhanghang1989/PyTorch-Encoding/workflows/Upload%20Python%20Package/badge.svg)](https://github.com/zhanghang1989/PyTorch-Encoding/actions) [![Downloads](http://pepy.tech/badge/torch-encoding)](http://pepy.tech/project/torch-encoding) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Build Docs](https://github.com/zhanghang1989/PyTorch-Encoding/workflows/Build%20Docs/badge.svg)](https://github.com/zhanghang1989/PyTorch-Encoding/actions) # PyTorch-Encoding @@ -11,10 +12,23 @@ created by [Hang Zhang](http://hangzh.com/) - Please visit the [**Docs**](http://hangzh.com/PyTorch-Encoding/) for detail instructions of installation and usage. -- Please visit the [link](http://hangzh.com/PyTorch-Encoding/experiments/segmentation.html) to examples of semantic segmentation. +- Please visit the [link](http://hangzh.com/PyTorch-Encoding/model_zoo/imagenet.html) to image classification models. + +- Please visit the [link](http://hangzh.com/PyTorch-Encoding/model_zoo/segmentation.html) to semantic segmentation models. ## Citations +**ResNeSt: Split-Attention Networks** [[arXiv]]() + [Hang Zhang](http://hangzh.com/), Chongruo Wu, Zhongyue Zhang, Yi Zhu, Zhi Zhang, Haibin Lin, Yue Sun, Tong He, Jonas Muller, R. Manmatha, Mu Li and Alex Smola +``` +@article{zhang2020resnest, +title={ResNeSt: Split-Attention Networks}, +author={Zhang, Hang and Wu, Chongruo and Zhang, Zhongyue and Zhu, Yi and Zhang, Zhi and Lin, Haibin and Sun, Yue and He, Tong and Muller, Jonas and Manmatha, R. and Li, Mu and Smola, Alexander}, +journal={arXiv preprint}, +year={2020} +} +``` + **Context Encoding for Semantic Segmentation** [[arXiv]](https://arxiv.org/pdf/1803.08904.pdf) [Hang Zhang](http://hangzh.com/), [Kristin Dana](http://eceweb1.rutgers.edu/vision/dana.html), [Jianping Shi](http://shijianping.me/), [Zhongyue Zhang](http://zhongyuezhang.com/), [Xiaogang Wang](http://www.ee.cuhk.edu.hk/~xgwang/), [Ambrish Tyagi](https://scholar.google.com/citations?user=GaSWCoUAAAAJ&hl=en), [Amit Agrawal](http://www.amitkagrawal.com/) ``` diff --git a/docs/source/index.rst b/docs/source/index.rst index fb8a9567..4cfcadcb 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -13,16 +13,23 @@ An optimized PyTorch package with CUDA backend. .. toctree:: :glob: :maxdepth: 1 - :caption: Notes + :caption: Installation notes/* .. toctree:: :glob: :maxdepth: 1 - :caption: Experiment Systems + :caption: Model Zoo - experiments/* + model_zoo/* + +.. toctree:: + :glob: + :maxdepth: 1 + :caption: Other Tutorials + + tutorials/* .. toctree:: :maxdepth: 1 @@ -30,7 +37,6 @@ An optimized PyTorch package with CUDA backend. nn parallel - models utils Indices and tables diff --git a/docs/source/model_zoo/imagenet.rst b/docs/source/model_zoo/imagenet.rst new file mode 100644 index 00000000..982c7ca2 --- /dev/null +++ b/docs/source/model_zoo/imagenet.rst @@ -0,0 +1,83 @@ +Image Classification +==================== + +Install Package +--------------- + +- Clone the GitHub repo:: + + git clone https://github.com/zhanghang1989/PyTorch-Encoding + +- Install PyTorch Encoding (if not yet). Please follow the installation guide `Installing PyTorch Encoding <../notes/compile.html>`_. + +Get Pre-trained Model +--------------------- + +.. hint:: + How to get pretrained model, for example ``ResNeSt50``:: + + model = encoding.models.get_model('ResNeSt50', pretrained=True) + + After clicking ``cmd`` in the table, the command for training the model can be found below the table. + +.. role:: raw-html(raw) + :format: html + + +ResNeSt +~~~~~~~ + +.. note:: + The provided models were trained using MXNet Gluon, this PyTorch implementation is slightly worse than the original implementation. + +=============================== ============== ============== ========================================================================================================= +Model crop-size Acc Command +=============================== ============== ============== ========================================================================================================= +ResNeSt-50 224 81.03 :raw-html:`cmd` +ResNeSt-101 256 82.83 :raw-html:`cmd` +ResNeSt-200 320 83.84 :raw-html:`cmd` +ResNeSt-269 416 84.54 :raw-html:`cmd` +=============================== ============== ============== ========================================================================================================= + +.. raw:: html + + + + + + + + + +Test Pretrained +~~~~~~~~~~~~~~~ + +- Prepare the datasets by downloading the data into current folder and then runing the scripts in the ``scripts/`` folder:: + + python scripts/prepare_imagenet.py --data-dir ./ + +- The test script is in the ``experiments/recognition/`` folder. For evaluating the model (using MS), + for example ``ResNeSt50``:: + + python test.py --dataset imagenet --model-zoo ResNeSt50 --crop-size 224 --eval + +Train Your Own Model +-------------------- + +- Prepare the datasets by downloading the data into current folder and then runing the scripts in the ``scripts/`` folder:: + + python scripts/prepare_imagenet.py --data-dir ./ + +- The training script is in the ``experiments/recognition/`` folder. Commands for reproducing pre-trained models can be found in the table. diff --git a/docs/source/experiments/segmentation.rst b/docs/source/model_zoo/segmentation.rst similarity index 59% rename from docs/source/experiments/segmentation.rst rename to docs/source/model_zoo/segmentation.rst index cbd74b23..72bc3646 100644 --- a/docs/source/experiments/segmentation.rst +++ b/docs/source/model_zoo/segmentation.rst @@ -1,5 +1,5 @@ -Context Encoding for Semantic Segmentation (EncNet) -=================================================== +Semantic Segmentation +===================== Install Package --------------- @@ -29,31 +29,52 @@ Get Pre-trained Model :format: html -.. tabularcolumns:: |>{\centering\arraybackslash}\X{4}{5}|>{\raggedleft\arraybackslash}\X{1}{5}| +ResNeSt Backbone Models +----------------------- -============================================================================== ============== ============== ============================================================================================= +============================================================================== ============== ============== ========================================================================================================= Model pixAcc mIoU Command -============================================================================== ============== ============== ============================================================================================= -Encnet_ResNet50_PContext 79.2% 51.0% :raw-html:`cmd` -EncNet_ResNet101_PContext 80.7% 54.1% :raw-html:`cmd` -EncNet_ResNet50_ADE 80.1% 41.5% :raw-html:`cmd` -EncNet_ResNet101_ADE 81.3% 44.4% :raw-html:`cmd` -EncNet_ResNet101_VOC N/A 85.9% :raw-html:`cmd` -============================================================================== ============== ============== ============================================================================================= - +============================================================================== ============== ============== ========================================================================================================= +FCN_ResNeSt50_ADE xx.xx% xx.xx% :raw-html:`cmd` +DeepLabV3_ResNeSt50_ADE 81.17% 45.12% :raw-html:`cmd` +DeepLabV3_ResNeSt101_ADE 82.07% 46.91% :raw-html:`cmd` +============================================================================== ============== ============== ========================================================================================================= .. raw:: html -