Giter Site home page Giter Site logo

liyunjamesphd / nettailor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pedro-morgado/nettailor

0.0 0.0 0.0 113.08 MB

Source code accompanying our CVPR 2019 paper: "NetTailor: Tuning the architecture, not just the weights."

Home Page: https://pedro-morgado.github.io/nettailor/

License: Other

Python 1.75% Jupyter Notebook 98.25%

nettailor's Introduction

NetTailor [Project Page]

This repository contains the source code accompanying our CVPR 2019 paper.

NetTailor: Tuning the architecture, not just the weights.
Pedro Morgado, Nuno Vasconcelos.
In Computer Vision and Pattern Recognition, 2019.

@inproceedings{morgado_nettailor,
	title={NetTailor: Tuning the architecture, not just the weights},
	author={Pedro Morgado and Nuno Vasconcelos},
	booktitle={Computer Vision and Pattern recognition (CVPR)},
	year={2019}
}

Requirements

  1. pytorch & torchvision
  2. COCO API (from https://github.com/cocodataset/cocoapi)

Getting started

NOTE: This repo is still under development. If you find any issues running our code, missing files, etc, please do contact me.

Download and prepare demo datasets: SVHN, Flowers and Pascal VOC.

>> cd data && python prepare_data.py

If interested in Visual Decathlon results, download data and models.

>> cd data && python download_decathlon.py && cd ../checkpoints && python download_models.py

Training NetTailor

We demonstrate on three demo datasets how to use the NetTailor procedure to adapt the network architecture to a target task.

Code tour
  1. dataloaders.py: Dataloaders for demo datasets.
  2. nettailor.py and resnet.py: Model definition for the student and teacher networks, respectively, based on resnet backbone.
  3. main_student.py and main_teacher.py: Training and evaluation code for the student and teacher networks, respectively.

Usage: Refer to the three demo_xxx.py scripts. These demonstrates how to 1) train the teacher network, 2) train the student network and 3) prune and retrain the student.

To execute with default parameters, simply run:

>> python demo_svhn.py
>> python demo_flowers.py
>> python demo_voc12.py

Disclaimer: After publication, we modified the dataloader for the VOC12 and SVHN datasets to remove random cropping. This resulted in better performance than published results.

NetTailor on Visual Decathlon Challenge and trained models

We also release the final models obtained in the visual decathlon challenge. Universal blocks can be downloaded here and task-specific blocks here.

Code tour
  1. decathlon_dataloaders.py: Dataloaders for visual decathlon data.
  2. wide_nettailor.py and wide_resnet.py: Model definition for the student and teacher networks, respectively, based on wide resnet backbone.
  3. main_student_decathlon.py and main_teacher_decathlon.py: Training and evaluation code for the student and teacher networks, respectively.

Usage: Refer to the deploy_decathlon.ipynb notebook for a usage example. This notebook also showcases some predictions obtained with models trained with NetTailor on all nine datasets from the visual decathlon challenge.

If you encounter any issue when using our code or models, please let me know.

nettailor's People

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.