Giter Site home page Giter Site logo

marsaki / nasnet Goto Github PK

View Code? Open in Web Editor NEW
42.0 1.0 13.0 22.81 MB

reimplementation of "Learning Transferable Architectures for Scalable Image Recognition" using mnist dataset, include controller

Python 99.35% Shell 0.65%
nasnet automl image-classification neural-architecture-search pytorch-implementation

nasnet's Introduction

NasNet 2018

This code is the reimplementation of "Learning Transferable Architectures for Scalable Image Recognition", including the training process of controller. This code contains three algorithms to search model, Random Search, Policy Gradient and PPO.

Requirements

Python >= 3.6.7, PyTorch == 0.4.0

Architecture Search

python train_search.py --cutout --algorithm RS  #use random search
python train_search.py --cutout --algorithm PG  #use policy gradient
python train_search.py --cutout --algorithm PPO #use PPO

Note the validation performance in this step does not indicate the final performance of the architecture. One must train the obtained genotype/architecture from scratch using full-sized models. Also the default setting is training with 20 processes and 3 GPU. Change the processes to 10:

python train_search.py --cutout --episodes 10

or modify code in random_search.py, policy_gradient.py and PPO.py .

Architecture Evaluation

Because of the limitation of time and computation resource, I didn't train the candidate genotypes/architectures from scratch.

Results

python draw.py

search_process

We can see RL search is better than random search, also PPO is more stable and faster.

nasnet's People

Contributors

marsaki 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

Watchers

 avatar

nasnet's Issues

policy_gradient.py's problems

hello.
I have two questions in policy_gradient.py to ask you.
first:
def cal_loss(self, actions_p, actions_log_p, worker, baseline):
reward = worker.acc - baseline
policy_loss = -1 * torch.sum(actions_log_p * reward)
entropy = -1 * torch.sum(actions_p * actions_log_p)
entropy_bonus = -1 * entropy * self.entropy_weight
what does entory mean?
second:
for episode in range(self.episodes):
worker = results_queue.get()
# worker.actions_p = torch.Tensor(worker.actions_p).to(self.device)
worker.actions_index = torch.LongTensor(worker.actions_index).to(self.device)
workers.append(worker)

worker.actions_index = torch.LongTensor(worker.actions_index).to(self.device) ,the worker.actions_index does't change?

What the step means in controller

What does the step mean in the controller?

for node in range(self.steps):

I think it's a number of blocks in each cell. In the original paper, there are 5 blocks in either normal cell or reduction cell.

why it is 4?

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.