Giter Site home page Giter Site logo

a-classifier-with-pytorc_deep_learn's Introduction

🍀 基于Torchvision中的经典模型调用 😋

This code calls the models in Torchvision, and the classification network topic framework is derived from Torchvision. 基于torchvision中的模型写了的调用接口,对于刚开始学习深度学习的人可以以此来跑各个经典模型的demo,如需了解具体网络框架和代码细节可以深入torchvision源码。例如以下经典的分类模型和分割模型都可以调用:

from .alexnet import *
from .resnet import *
from .vgg import *
from .squeezenet import *
from .inception import *
from .densenet import *
from .googlenet import *
from .mobilenet import *
from .mnasnet import *
from .shufflenetv2 import *
from . import segmentation
from . import detection
from . import video

image info

#Several classification frameworks are available
AlexNetdensenet121densenet169densenet201densenet161GoogLeNetInception3mnasnet0_5mnasnet0_75mnasnet1_0mnasnet1_3MobileNetV2resnet18resnet34resnet50resnet101resnet152resnext50_32x4dresnext101_32x8dwide_resnet50_2wide_resnet101_2vgg11vgg13vgg16vgg19vgg11_bnvgg13_bnvgg16_bnvgg19_bn...........

The above is the classic network framework available within the models, and only for the classification networks within.This code is can take transfer learning , download the ImageNet pre trained initial model and then transfer learning in your code, and can be frozen convolution training only full connection layer, or global training, we only use the convolution of the classic network layer, and then the convolution results set on our lightweight classifier,

🌈 Train on our datasets

We used this classifier to predict the gender of the chicken, and we used vgg16,vgg16_bn,vgg19,vgg19_bn,resnet18,resnet34、densenet101 made a comparison。You can get our dataset here 我们用的是自己制作的一个鸡性别分类数据集,可以在谷歌云盘中获得我们的数据,

Some sample images from Our dataset: image info

🌟 Train on Custom Dataset

如果需要在你自己的数据集上运行,只需要如下面的结构存放即可,n代表你是几分类任务,例如train下label_1下是存放第一个类别的所有训练图像,以此类推

-your datasets
 |--train
 |   |--label_1
 |   |--label_2
 |   |--label_n
 |--test or Val
     |--label_1
     |--label_2
     |--label_n

Your data set needs to look like the file structure above.And if you're not dichotomous, change the last output dimension from 2 to n。 Then execute the following command

python train.py --data_directory=your dataset --arch=vgg16 data_directory用以指明你的数据集路径地址,arch为选择的模型名 if you want to train on resnet or densenet and other, you can change the --arch=vgg16 to --arch=resnet34 or -- arch=densenet101 or other

Visualization of Training Process

Use tensorboard for visualization. After training, you can enter the following command for visualization.

Then visit the page that pops up on the command line,the following image will appear

tensorboard --logdirs=logs

image info

Visit the above page and download the corresponding CSV, then plot the training process according to csv_plot.py: image info You can adjust the parameters to make the training process more beautiful

a-classifier-with-pytorc_deep_learn's People

Contributors

yaoyuanzhou 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.