Skip to content

Instantly share code, notes, and snippets.

MODEL:
META_ARCHITECTURE: "Detr"
WEIGHTS: "detectron2://ImageNetPretrained/torchvision/R-50.pkl"
PIXEL_MEAN: [123.675, 116.280, 103.530]
PIXEL_STD: [58.395, 57.120, 57.375]
MASK_ON: False
BACKBONE:
NAME: "build_resnet_backbone"
RESNETS:
DEPTH: 50
@zhanghang1989
zhanghang1989 / setup_tutorial_instance.sh
Created June 14, 2020 03:45
CVPR Tutorial SM Setup
wget https://raw.githubusercontent.com/zhanghang1989/AutoGluon-Tutorial-CVPR2020/master/6.pytorch_hpo.ipynb quick_start.ipynb
wget https://raw.githubusercontent.com/zhanghang1989/AutoGluon-Tutorial-CVPR2020/master/7.enas_mnist.ipynb proxylessnas.ipynb
mkdir -p ILSVRC2012 && cd ILSVRC2012/
wget https://hanlab.mit.edu/files/OnceForAll/ofa_cvpr_tutorial/imagenet_subtrain.tar.gz
tar -xzvf imagenet_subtrain.tar.gz && rm imagenet_subtrain.tar.gz
mkdir -p val && cd val/
wget https://hangzh.s3-us-west-1.amazonaws.com/encoding/legacy/ILSVRC2012_img_val.tar
tar -xf ILSVRC2012_img_val.tar
@zhanghang1989
zhanghang1989 / life-cycle-configuration.sh
Last active March 12, 2020 17:48
tutorial sagemaker configuration
#!/bin/bash
sudo -u ec2-user -i <<'EOF'
cd ~
wget https://autogluon.s3-us-west-2.amazonaws.com/autogluon_tutorial/build_contrib.yml
conda env create --name autogluon -f build_contrib.yml
wget https://autogluon.s3-us-west-2.amazonaws.com/autogluon_tutorial/prefetch.py
source activate autogluon
aws s3 cp s3://zhiz-data/datasets/imagenet/ILSVRC2012_img_train.tar .
aws s3 cp s3://zhiz-data/datasets/imagenet/ILSVRC2012_img_val.tar .
cd ResNeSt/
python scripts/dataset/prepare_imagenet.py --download-dir ~/
@zhanghang1989
zhanghang1989 / atten.py
Created September 4, 2019 02:46
Co-occurrent Features in Semantic Segmentation
###########################################################################
# Created by: Hang Zhang
# Email: zhang.hang@rutgers.edu
# Copyright (c) 2018
###########################################################################
from __future__ import division
import os
import numpy as np
import torch
import torch.nn as nn
@zhanghang1989
zhanghang1989 / terminal_01.sh
Created January 11, 2019 20:12
get ride of wired 0~ ~1
printf "\e[?2004l"
@zhanghang1989
zhanghang1989 / set_p3_dn.sh
Last active November 18, 2020 07:25
Mount drives for aws p3 dn
sudo mkfs -t ext4 /dev/nvme1n1
sudo mkfs -t ext4 /dev/nvme2n1
mkdir drive1
mkdir drive2
sudo mount /dev/nvme1n1 drive1/
sudo mount /dev/nvme2n1 drive2/
sudo chmod a+rwx drive1/
sudo chmod a+rwx drive2/
find . -name \*.swp -type f -delete
@zhanghang1989
zhanghang1989 / auto_compress.py
Last active April 4, 2020 03:53
automatically create zip file for model_zoo upload
import os
from os import listdir
from os.path import isfile, join
import hashlib
import shutil
import zipfile
mypath = './'
newpath = './zip'

PyTorch to MXNet

This cheatsheet serves as a quick reference for PyTorch users who are interested in trying MXNet, and vice versa.

Pytorch is a deep learning framework provides imperative tensor manipulation and neural network training. MXNet provides similar imperative tensor manipulation through the ndarray package and neural network training through gluon. This cheatsheet maps functions one-by-one between these two frameworks.

Note that MXNet has a symbolic interface similar to Keras and Tensorflow that may provide better performance and portability. This cheatsheet mainly focus on MXNet's imperative interface.

Installation