Unofficial Pytorch Lightning implementation of Contrastive Syn-to-Real Generalization (ICLR, 2021)

Related tags

Deep LearningCSG
Overview

CSG-lightning

Unofficial Pytorch Lightning implementation of Contrastive Syn-to-Real Generalization (ICLR 2021).

Based on:

Environment Setup

Tested in a Python 3.8 environment in Linux and Windows with:

Installing the dependencies:

pip install pytorch-lightning lightning-bolts torchmetrics

Classification (VisDA17)

Dataset Setup

Download VisDA17 dataset from official website or, use the provided script for your convenience.

# The script downloads and extracts VisDA17 dataset.
# Note: It takes a very long time to download full dataset.
python datasets/prepare_visda17.py

If you downloaded the dataset manually, extract and place them as below.

๐Ÿ“‚ datasets
 โ”ฃ ๐Ÿ“‚ visda17
 โ”ƒ โ”ฃ ๐Ÿ“‚ train
 โ”ƒ โ”ƒ ๐Ÿ“‚ validation
 โ”— โ”— ๐Ÿ“‚ test

How to run

Training

Simply run:

python run.py

or with options,

usage: run.py [-h] [-o OUTPUT] [-r ROOT] [-e EPOCHS] [-lr LEARNING_RATE] [-bs BATCH_SIZE] [-wd WEIGHT_DECAY] [--task {classification,segmentation}] [--encoder {resnet101,deeplab50,deeplab101}] [--momentum MOMENTUM] [--num-classes NUM_CLASSES] [--eval-only] [--gpus GPUS]
              [--resume RESUME] [--dev-run] [--exp-name EXP_NAME] [--augmentation AUGMENTATION] [--seed SEED] [--fc-dim FC_DIM] [--no-apool] [--single-network] [--stages STAGES [STAGES ...]] [--emb-dim EMB_DIM] [--emb-depth EMB_DEPTH] [--num-patches NUM_PATCHES]
              [--moco-weight MOCO_WEIGHT] [--moco-queue-size MOCO_QUEUE_SIZE] [--moco-momentum MOCO_MOMENTUM] [--moco-temperature MOCO_TEMPERATURE]

Evaluation

python run.py --eval-only --resume https://github.com/ryanking13/CSG/releases/download/v0.2/csg_resnet101.ckpt

Results

Model Accuracy
CSG (from paper) 64.1
CSG (reimpl) 67.1

Semantic Segmentation

Dataset Setup (GTA5 ==> Cityscapes)

Download GTA5 and Cityscapes datasets.

Place them as below.

๐Ÿ“‚ datasets
 โ”ฃ ๐Ÿ“‚ GTA5
 โ”ƒ โ”ฃ ๐Ÿ“‚ images 
 โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“œ 00001.png
 โ”ƒ โ”ƒ โ”ฃ ...
 โ”ƒ โ”ƒ โ”— ๐Ÿ“œ 24966.png
 โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ labels
 โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“œ 00001.png
 โ”ƒ โ”ƒ โ”ฃ ...
 โ”ƒ โ”ƒ โ”— ๐Ÿ“œ 24966.png
 โ”ฃ ๐Ÿ“‚ cityscapes
 โ”ƒ โ”ฃ ๐Ÿ“‚ leftImg8bit
 โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ train
 โ”ƒ โ”ƒ โ”ƒ ๐Ÿ“‚ val
 โ”— โ”— โ”— ๐Ÿ“‚ test
 โ”ƒ โ”ฃ ๐Ÿ“‚ gtFine 
 โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ train
 โ”ƒ โ”ƒ โ”ƒ ๐Ÿ“‚ val
 โ”— โ”— โ”— ๐Ÿ“‚ test

How to run

Training

Simply run:

./run_seg.sh

Evaluation

./run_seg --eval-only --resume https://github.com/ryanking13/CSG/releases/download/v0.2/csg_deeplab50.ckpt

Results

Model IoU
CSG (from paper) 35.27
CSG (reimpl) 34.71

Differences from official implementation

  • Warmup LR scheduler
  • No layerwise LR modification
  • RandAugment augmentation types

Known Issues

  • I got error Distributed package doesn't have NCCL built in

On windows, nccl is not supported, try:

set PL_TORCH_DISTRIBUTED_BACKEND=gloo
You might also like...
Unofficial PyTorch implementation of
Unofficial PyTorch implementation of "RTM3D: Real-time Monocular 3D Detection from Object Keypoints for Autonomous Driving" (ECCV 2020)

RTM3D-PyTorch The PyTorch Implementation of the paper: RTM3D: Real-time Monocular 3D Detection from Object Keypoints for Autonomous Driving (ECCV 2020

RGBD-Net - This repository contains a pytorch lightning implementation for the 3DV 2021 RGBD-Net paper.
RGBD-Net - This repository contains a pytorch lightning implementation for the 3DV 2021 RGBD-Net paper.

[3DV 2021] We propose a new cascaded architecture for novel view synthesis, called RGBD-Net, which consists of two core components: a hierarchical depth regression network and a depth-aware generator network.

An essential implementation of BYOL in PyTorch + PyTorch Lightning
An essential implementation of BYOL in PyTorch + PyTorch Lightning

Essential BYOL A simple and complete implementation of Bootstrap your own latent: A new approach to self-supervised Learning in PyTorch + PyTorch Ligh

Unofficial implementation of
Unofficial implementation of "TTNet: Real-time temporal and spatial video analysis of table tennis" (CVPR 2020)

TTNet-Pytorch The implementation for the paper "TTNet: Real-time temporal and spatial video analysis of table tennis" An introduction of the project c

Implementation of Geometric Vector Perceptron, a simple circuit for 3d rotation equivariance for learning over large biomolecules, in Pytorch. Idea proposed and accepted at ICLR 2021
Implementation of Geometric Vector Perceptron, a simple circuit for 3d rotation equivariance for learning over large biomolecules, in Pytorch. Idea proposed and accepted at ICLR 2021

Geometric Vector Perceptron Implementation of Geometric Vector Perceptron, a simple circuit with 3d rotation equivariance for learning over large biom

Pytorch implementation of BRECQ, ICLR 2021

BRECQ Pytorch implementation of BRECQ, ICLR 2021 @inproceedings{ li&gong2021brecq, title={BRECQ: Pushing the Limit of Post-Training Quantization by Bl

Implementation of 'lightweight' GAN, proposed in ICLR 2021, in Pytorch. High resolution image generations that can be trained within a day or two
Implementation of 'lightweight' GAN, proposed in ICLR 2021, in Pytorch. High resolution image generations that can be trained within a day or two

512x512 flowers after 12 hours of training, 1 gpu 256x256 flowers after 12 hours of training, 1 gpu Pizza 'Lightweight' GAN Implementation of 'lightwe

This repo contains the pytorch implementation for Dynamic Concept Learner (accepted by ICLR 2021).
This repo contains the pytorch implementation for Dynamic Concept Learner (accepted by ICLR 2021).

DCL-PyTorch Pytorch implementation for the Dynamic Concept Learner (DCL). More details can be found at the project page. Framework Grounding Physical

An implementation demo of the ICLR 2021 paper Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networks in PyTorch.

Neural Attention Distillation This is an implementation demo of the ICLR 2021 paper Neural Attention Distillation: Erasing Backdoor Triggers from Deep

Releases(v0.2)
Owner
Gyeongjae Choi
Gyeongjae Choi
code for the ICLR'22 paper: On Robust Prefix-Tuning for Text Classification

On Robust Prefix-Tuning for Text Classification Prefix-tuning has drawed much attention as it is a parameter-efficient and modular alternative to adap

Zonghan Yang 12 Nov 30, 2022
(Py)TOD: Tensor-based Outlier Detection, A General GPU-Accelerated Framework

(Py)TOD: Tensor-based Outlier Detection, A General GPU-Accelerated Framework Background: Outlier detection (OD) is a key data mining task for identify

Yue Zhao 127 Jan 05, 2023
TensorFlow implementation of AlexNet and its training and testing on ImageNet ILSVRC 2012 dataset

AlexNet training on ImageNet LSVRC 2012 This repository contains an implementation of AlexNet convolutional neural network and its training and testin

Matteo Dunnhofer 161 Nov 25, 2022
A basic neural network for image segmentation.

Unet_erythema_detection A basic neural network for image segmentation. ๅ‰ๆœŸๅ‡†ๅค‡ 1.ๅœจlogsๆ–‡ไปถๅคนไธญไธ‹่ฝฝh5ๆƒ้‡ๆ–‡ไปถ๏ผŒ็™พๅบฆ็ฝ‘็›˜้“พๆŽฅๅœจlogsๆ–‡ไปถๅคนไธญ 2.ๅฐ†ๆ‰€ๆœ‰ๅŽŸๅ›พ ๆ”พ็ฝฎๅœจโ€œ/dataset_1/JPEGImages/โ€ๆ–‡ไปถๅคน

1 Jan 16, 2022
OpenMatch: Open-set Consistency Regularization for Semi-supervised Learning with Outliers (NeurIPS 2021)

OpenMatch: Open-set Consistency Regularization for Semi-supervised Learning with Outliers (NeurIPS 2021) This is an PyTorch implementation of OpenMatc

Vision and Learning Group 38 Dec 26, 2022
This is the code for ACL2021 paper A Unified Generative Framework for Aspect-Based Sentiment Analysis

This is the code for ACL2021 paper A Unified Generative Framework for Aspect-Based Sentiment Analysis Install the package in the requirements.txt, the

108 Dec 23, 2022
tf2onnx - Convert TensorFlow, Keras and Tflite models to ONNX.

tf2onnx converts TensorFlow (tf-1.x or tf-2.x), tf.keras and tflite models to ONNX via command line or python api.

Open Neural Network Exchange 1.8k Jan 08, 2023
Only valid pull requests will be allowed. Use python only and readme changes will not be accepted.

โŒ This repo is excluded from hacktoberfest This repo is for python beginners and contains lot of beginner python projects for practice. You can also s

Prajjwal Pathak 50 Dec 28, 2022
Llvlir - Low Level Variable Length Intermediate Representation

Low Level Variable Length Intermediate Representation Low Level Variable Length

Michael Clark 2 Jan 24, 2022
RGB-stacking ๐Ÿ›‘ ๐ŸŸฉ ๐Ÿ”ท for robotic manipulation

RGB-stacking ๐Ÿ›‘ ๐ŸŸฉ ๐Ÿ”ท for robotic manipulation BLOG | PAPER | VIDEO Beyond Pick-and-Place: Tackling Robotic Stacking of Diverse Shapes, Alex X. Lee*,

DeepMind 95 Dec 23, 2022
Measuring Coding Challenge Competence With APPS

Measuring Coding Challenge Competence With APPS This is the repository for Measuring Coding Challenge Competence With APPS by Dan Hendrycks*, Steven B

Dan Hendrycks 218 Dec 27, 2022
A rule learning algorithm for the deduction of syndrome definitions from time series data.

README This project provides a rule learning algorithm for the deduction of syndrome definitions from time series data. Large parts of the algorithm a

0 Sep 24, 2021
Tensorflow Implementation for "Pre-trained Deep Convolution Neural Network Model With Attention for Speech Emotion Recognition"

Tensorflow Implementation for "Pre-trained Deep Convolution Neural Network Model With Attention for Speech Emotion Recognition" Pre-trained Deep Convo

Ankush Malaker 5 Nov 11, 2022
Continual Learning of Electronic Health Records (EHR).

Continual Learning of Longitudinal Health Records Repo for reproducing the experiments in Continual Learning of Longitudinal Health Records (2021). Re

Jacob 7 Oct 21, 2022
TorchIO is a Medical image preprocessing and augmentation toolkit for deep learning. Part of the PyTorch Ecosystem.

Medical image preprocessing and augmentation toolkit for deep learning. Part of the PyTorch Ecosystem.

Fernando Pรฉrez-Garcรญa 1.6k Jan 06, 2023
Code for our paper "Multi-scale Guided Attention for Medical Image Segmentation"

Medical Image Segmentation with Guided Attention This repository contains the code of our paper: "'Multi-scale self-guided attention for medical image

Ashish Sinha 394 Dec 28, 2022
Frigate - NVR With Realtime Object Detection for IP Cameras

A complete and local NVR designed for HomeAssistant with AI object detection. Uses OpenCV and Tensorflow to perform realtime object detection locally for IP cameras.

Blake Blackshear 6.4k Dec 31, 2022
Layer 7 DDoS Panel with Cloudflare Bypass ( UAM, CAPTCHA, BFM, etc.. )

Blood Deluxe DDoS DDoS Attack Panel includes CloudFlare Bypass (UAM, CAPTCHA, BFM, etc..)(It works intermittently. Working on it) Don't attack any web

272 Nov 01, 2022
Auto HMM: Automatic Discrete and Continous HMM including Model selection

Auto HMM: Automatic Discrete and Continous HMM including Model selection

Chess_champion 29 Dec 07, 2022
Implementation of the state-of-the-art vision transformers with tensorflow

ViT Tensorflow This repository contains the tensorflow implementation of the state-of-the-art vision transformers (a category of computer vision model

Mohammadmahdi NouriBorji 2 Mar 16, 2022