Coder Social home page Coder Social logo

adeelh / pytorch-fpn Goto Github PK

View Code? Open in Web Editor NEW
48.0 4.0 8.0 59 KB

PyTorch implementations of some FPN-based semantic segmentation architectures: vanilla FPN, Panoptic FPN, PANet FPN; with ResNet and EfficientNet backbones.

License: MIT License

Python 100.00%
semantic-segmentation fpn feature-pyramid-network deep-learning deeplearning machine-learning implementation-of-research-paper pytorch pytorch-implementation neural-network

pytorch-fpn's Introduction

pytorch-fpn

PyTorch implementation of the following semantic segmentation architectures (see fpn.py):

The implementations are all based on nn.Sequential with no fancy forward methods, meaning that they can be easily modified and combined together or with other modules.

Backbones

The repo provides factory functions (make_fpn_resnet() and make_fpn_efficientnet()) for creating FPN's with 2 kinds of backbones:

Multiband images

The factory methods make_fpn_resnet() and make_fpn_efficientnet() support in_channels != 3.

make_fpn_resnet(), in particular, makes use of the fusion technique described in the paper, FuseNet, by Hazirbas et al. (https://vision.in.tum.de/_media/spezial/bib/hazirbasma2016fusenet.pdf) if in_channels > 3 that adds a parallel resnet backbone for the new channels. All the pretrained weights are retained.

Usage

from factory import make_fpn_resnet

model = make_fpn_resnet(
	name='resnet18',
	fpn_type='fpn',
	pretrained=True,
	num_classes=2,
	fpn_channels=256,
	in_channels=3,
	out_size=(224, 224))

Loading through torch.hub

This repo supports importing modules through torch.hub. The models can be easily imported into your code via the factory functions in factory.py.

import torch

model = torch.hub.load(
	'AdeelH/pytorch-fpn',
	'make_fpn_resnet',
	name='resnet18',
	fpn_type='panoptic',
	num_classes=2,
	fpn_channels=256,
	in_channels=3,
	out_size=(224, 224)
)

Working example on Colab: https://colab.research.google.com/drive/1pjkw-QoqiXgKDrEYZ47EwfXcW7vgO4KX?usp=sharing

pytorch-fpn's People

Contributors

adeelh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pytorch-fpn's Issues

Tuple Unpacking Error

I am getting an error on this line. It seems that sometimes inps is a tuple of four rather than the expect two. I am using this with the last pre-nochip version of raster vision.

Fusion Process Assumes Location of RGB Channels

The fusion process here seems to assume that the RGB channels are the first three channels of the input (that is, the 3 channels from the pretrained input layer are always matched with the first three channels of the input).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.