• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    Python
  • Created over 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A TensorFlow re-implementation of Momentum Contrast (MoCo): https://arxiv.org/abs/1911.05722

Implement and reproduce results of the following papers:

Dependencies:

  • TensorFlow 1.14 or 1.15, built with XLA support
  • Tensorpack ≥ 0.10.1
  • Horovod ≥ 0.19 built with Gloo & NCCL support
  • TensorFlow zmq_ops
  • OpenCV
  • the taskset command (from the util-linux package)

Unsupervised Training:

To run MoCo pre-training on a machine with 8 GPUs, use:

horovodrun -np 8 --output-filename moco.log python main_moco.py --data /path/to/imagenet

Add --v2 to train MoCov2, which uses an extra MLP layer, extra augmentations, and cosine LR schedule.

Linear Classification:

To train a linear classifier using the pre-trained features, run:

./main_lincls.py --load /path/to/pretrained/checkpoint --data /path/to/imagenet

KNN Evaluation:

Instead of Linear Classification, a cheap but rough evaluation is to perform a feature-space kNN using the training set:

horovodrun -np 8 ./eval_knn.py --load /path/to/checkpoint --data /path/to/imagenet --top-k 200

Results:

Training was done in a machine with 8 V100s, >200GB RAM and 80 CPUs.

Following results are obtained after 200 epochs of pre-training (~53h) and 100 epochs of linear classifier tuning (~8h). KNN evaluation takes 10min per checkpoint.

linear cls.
accuracy
download
(pretrained only)
tensorboard
MoCo v1 60.9% ⬇️ N/A
MoCo v2 67.7% ⬇️ pretrain; finetune

Notes:

  • Horovod with Gloo is recommended. Horovod with MPI is not tested and may crash due to how we use forking.
  • If using TensorFlow without XLA support, you can modify main_*.py to replace xla.compile by a naive forward.
  • Official PyTorch code is at facebookresearch/moco.

More Repositories

1

OpenPano

Automatic Panorama Stitching From Scratch
C++
1,844
star
2

wechat-dump

Cracking encrypted wechat message history from android
Python
1,645
star
3

speaker-recognition

A Speaker Recognition System
C++
675
star
4

Adversarial-Face-Attack

Black-Box Adversarial Attack on Public Face Recognition Systems
Python
401
star
5

dash-docset-tensorflow

dash/zeal docset for TensorFlow 1 & 2
CSS
197
star
6

SoPaper

Automatically Search and Download Papers
Python
194
star
7

RAM-multiprocess-dataloader

Demystify RAM Usage in Multi-Process Data Loaders
Python
169
star
8

cocoapi

Contains the "pycocotools" package on PyPI. Changes made to the official cocoapi about packaging.
Jupyter Notebook
123
star
9

GroupNorm-reproduce

An official collection of code in different frameworks that reproduces experiments in "Group Normalization"
Python
117
star
10

Ray-Tracing-Engine

A Photorealistic 3D Rendering Engine
C++
104
star
11

dotfiles

my dotfiles..
Python
58
star
12

dotvim

Over 1200+ lines of vimrc
Vim Script
43
star
13

Stereo-Pose-Machines

Stereo Pose Machines - Real Time 3D Pose Estimation
Python
43
star
14

vim-PinyinSearch

help vim search Chinese by Pinyin
Vim Script
39
star
15

FRN-on-common-ImageNet-baseline

Filter Response Normalization tested on better ImageNet baselines.
Python
35
star
16

dash-docset-matlab

Generate Dash Docset for Matlab
22
star
17

haDNN

Proof-of-Concept CNN in Halide
C++
21
star
18

hexo-tag-vimhighlight

Highlight code using vim in hexo
CoffeeScript
20
star
19

duxiu-downloader

Download e-books from duxiu.com
JavaScript
14
star
20

math

notes on math
TeX
8
star
21

dash-docset-jax

Create nice dash/zeal docset for JAX+Flax
Python
7
star
22

N-Body

Parallel N-Body Simulation Program
C++
5
star
23

dash-docset-torch

Dash/zeal docset for torch
Shell
5
star
24

ImageResizer

An Image Resizer using Seam Carving alogrithm.
C++
5
star
25

sigmod14contest

Code for ACM SIGMOD 2014 programming contest
C++
5
star
26

tensorflow-wheels

A repo to store custom tensorflow wheels in releases
5
star
27

Mandelbrot-Set

draw Mandelbrot set based on Xwindow. Use mpi / openmp / pthread to speed up
C++
3
star
28

vim-SugarCpp

support SugarCpp in vim.
Vim Script
2
star
29

sudoku

A sudoku solver using dancing links and algorithm X
C++
1
star
30

googlecli

Command Line Google Search
Python
1
star