Coder Social home page Coder Social logo

dl-exp-toolkit's Introduction

Deep Learning Experiment Toolkit

Provides infrastructure to help you set up deep learning experiments in a second.
Acknowledgement: This toolkit is mainly adapted and modified from https://github.com/tribhuvanesh/knockoffnets/tree/master/knockoff

Usage & Explanations

  • config.py: Configuration file for setting:

    • Random seed
    • Default path for datasets, model zoo, etc.
    • Default parameters (i.g. mean and std of a dataset)
  • model_utils.py: Training and evaluation functions that are capable to:

    • Create log file for training and testing
    • Create informative checkpoint.
    • Checkpoint struction:
      • epoch
      • arch
      • state_dict
      • best_test_acc
      • optimizer
      • created_on
  • datasets: Manage all the datasets and corresponding default transformations durint training and testing. Current available datasets:

    • MNIST
    • CIFAR10
    • ImageNet
  • modelzoo: Manage all the models trained on different datasets. Current available datasets:

    • MNIST
    • CIFAR10
    • ImageNet

Example

import modelzoo.zoo as zoo
import datasets
import config as cfg

params = {"model_name":"resnet50",
          "dataset_name":"ImageNet1k", # CIFAR10 or MNIST
          "num_classes":1000,
          "pretrained":"imagenet"}
# Load model
model_name = params["model_name"]
dataset_name = params["dataset_name"]
modelfamily = datasets.dataset_to_modelfamily[dataset_name]
num_classes = params["num_classes"]
pretrained = params["pretrained"]
model = zoo.get_net(model_name, modelfamily, num_classes=num_classes, pretrained=pretrained)

# Load dataset

modelfamily = datasets.dataset_to_modelfamily[dataset_name]
dataset = datasets.__dict__[dataset_name]

# Load model checkpoint
checkpoint = torch.load(model_path)
start_epoch = checkpoint["epoch"]
best_test_acc = checkpoint["best_acc"]
model.load_state_dict(checkpoint["state_dict"])
optimizer.load_state_dict(checkpoint["optimizer"])

dl-exp-toolkit's People

Contributors

zhanyuanucb avatar

Watchers

 avatar

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.