• Stars
    star
    160
  • Rank 233,524 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Pytorch Implementation of Refinenet

Pytorch Implementation of RefineNet

Build Status

This is a Pytorch implementation of the Multipath RefineNet architecture from the paper.

Installation

Install PyTorch following instructions on their website. Then install this package:

pip install git+https://github.com/thomasjpfan/pytorch_refinenet.git

Implemented versions

  • Multi-path 4-Cascaded RefineNet: RefineNet4Cascade
  • Multi-path 4-Cascaded RefineNet With Improved Pooling: RefineNet4CascadePoolingImproved

There are diagrams of these two versions in the author's github repo. The improved pooling version adds an additional pooling/convolution layer and flips the order of the pooling/convolution layers in the Chained Residual Pooling block.

Usage

This implementation of the Multipath RefineNet has the following initialization:

class RefineNet4Cascade(nn.Module):

    def __init__(self,
                 input_shape,
                 num_classes=1,
                 features=256,
                 resnet_factory=models.resnet101,
                 pretrained=True,
                 freeze_resnet=True):
        ...

The input_shape is a tuple of(channels, size) which denotes the number of channels in the input image and the input width/height. For an input to flow cleanly through the resnet layers, the input size should be divisible by 32. The input size is assumed to be a square image/patch. For example the RefineNet4Cascade can be defined to intake 3x224x224 images:

import torch
from pytorch_refinenet import RefineNet4Cascade

net = RefineNet4Cascade((3, 224), num_classes=10)
x = torch.randn(1, 3, 224, 224)
y = net(x)
y.size()
# torch.Size([1, 10, 56, 56])

The number of channels outputed will equal num_classes and the size will be 1/4 the size of the input as described in the paper. You can upscale the to get back to the original resolution.

Training

The refinenet backbone is frozen by default, which means they will not be updated with gradients during training. The parameters method in RefineNet4Cascade was redefined to only return the parameters that require a gradident. Thus this will work for training:

net = RefineNet4Cascade((3, 224), num_classes=10)
opt = optim.Adam(net.parameters())

x = torch.randn(1, 3, 224, 224)
y = net(x)
...

More Repositories

1

redis-cluster-docker-swarm

Redis cluster cache configuration for docker swarm
Shell
108
star
2

awesome-python-data-science

A curated list of Python libraries used for data science.
65
star
3

ml-workshop-intro

Introduction to scikit-learn: Machine Learning in Python
Jupyter Notebook
20
star
4

ml-workshop-intermediate-2-of-2

Jupyter Notebook
17
star
5

docker-scaler

Microservice providing a REST API that scales services in Docker Swarm.
Go
17
star
6

slides-template-hugo

JavaScript
15
star
7

ml-workshop-intermediate-1-of-2

Jupyter Notebook
15
star
8

ml-workshop-advanced

Jupyter Notebook
15
star
9

ansible-docker-swarm-role

Configures a Docker Swarm cluster.
Python
15
star
10

data-umbrella-2020-streamlit-ml

Jupyter Notebook
13
star
11

rustimport_jupyter

Jupyter and iPython magic for compiling Python extensions written in Rust
Jupyter Notebook
12
star
12

pydata-2019-histgradientboosting

Jupyter Notebook
10
star
13

skconfig

Experimental library for sampling and validating scikit-learn parameters
Python
10
star
14

pydata2018_dc_skorch

Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Jupyter Notebook
6
star
15

sklearn-repo-status

Python
5
star
16

ml-workshop-intermediate-v2

Jupyter Notebook
5
star
17

scipy-2022-poisson

Jupyter Notebook
4
star
18

scipy-2021-streamlit-demo

Jupyter Notebook
4
star
19

pytorch_unet

Hassle Free UNet Implementation
Python
4
star
20

scipy-2021-streamlit

CSS
3
star
21

skorch_talk

Talk covering the features of skorch
Jupyter Notebook
3
star
22

slides-template-quarto

SCSS
3
star
23

scipy-2023-too-parallel

HTML
3
star
24

parallelism-python-libraries-design

CSS
3
star
25

ml-workshop-intro-v2

Jupyter Notebook
2
star
26

nyc-python-2020-lightning-how-calibrated-are-you

Jupyter Notebook
2
star
27

skvalid

Lightweight scikit-learn validation framework
Python
2
star
28

pydata-nyc-2022-parallelism

HTML
2
star
29

sklearn-set_output-material

CSS
2
star
30

ansible-setup-user-role

Setups User and SSH keys
Makefile
2
star
31

ansible-docker-role

Installs Docker-CE on an Ubuntu 16.04
Python
2
star
32

ansible-ufw-cluster-role

Configures UFW to allow port access between a cluster of hosts.
Makefile
2
star
33

ml-workshop-intro-v3

Jupyter Notebook
2
star
34

pydata-nyc-meetup-2024-stumpy

Time Series EDA with STUMPY
SCSS
2
star
35

cookiecutter-data-science

Flexiable data science template with a somewhat logical model experimental support.
Python
2
star
36

odsc_nyc_2019_06_29

1
star
37

data-umbrella-2020-streamlit-slides

Data Umbrella 2020 streamlit slides
CSS
1
star
38

libomp-osx-vendor

1
star
39

sk-typing

Python
1
star
40

2020-czi-scikit-learn

JavaScript
1
star
41

ansible-ubuntu-local-runner

Docker image used to test Ansible Roles that needs systemd.
Shell
1
star
42

sklearn_experimental_talk

1
star
43

etcd-snapper-b2

Go
1
star
44

ml-journal

Code and notebooks used to produce the analysis done on my blog.
Jupyter Notebook
1
star
45

ames_housing_hiplot

Jupyter Notebook
1
star
46

azure_pipeline_artifacts

Testing azure pipeline artifacts
1
star
47

2020-richmond-ds-meetup-gradient-boosting

JavaScript
1
star
48

ansible-docker-runner

Ansible runner for testing playbooks with docker connection
Shell
1
star
49

bench-slep014

Jupyter Notebook
1
star
50

ansible-rexray-s3fs-role

Ansible role for install Docker 1.13+ style rexray plugin
1
star
51

seaborn-docset

Dash docset for seaborn
Python
1
star
52

sksearchspace

Defines search spaces for scikit-lean estimators
Python
1
star
53

pydata-nyc-meetup-2023-contributing-open-source

SCSS
1
star
54

blog-scikit-learn

Hosting the scikit-learn blog.
SCSS
1
star
55

array-api-compat

Compatibility layer for NumPy to support the Array API
Python
1
star
56

arviz

Exploratory analysis of Bayesian models with Python
Python
1
star
57

cython_memoryview_abi3

Python
1
star
58

odsc-2024-east-flyte

HTML
1
star
59

imagespec-fast-builder

Python
1
star