Giter Site home page Giter Site logo

image-classification-pytorch's Introduction

image-classification-pytorch

准备

安装环境

pip install -r requirements.txt

训练

训练代码为train.py

开始训练

根据需求修改代码中的“预设参数”部分(如下)

batch_size = 4
learning_rate = 1e-4  # 学习率
epoches = 100  # 训练轮次
train_path = './dataset/train/'  # 训练集的路径
val_path = './dataset/val/'  # 验证集的路径
use_gpu = True  # 是否使用gpu

运行train.py开始训练

模型

训练的模型会保存在model文件夹下,目前的设置是每10个epoches会自动存一次,除此之外还会存一个表现最好的模型bestmodel.pth

训练数据

训练结束后会输出准确率acc和损失loss,并以图片形式存在当前目录下。

检测

检测代码为detect.py 根据需求修改代码中的“预设参数”部分(如下)

# 类型代号和名称对应的字典(用于在图像显示,可自行修改)
num_type = {0: "blight",
            1: "common_rust",
            2: "gray_leaf_spot",
            3: "healthy"}
use_gpu = True  # 是否使用gpu
val_path = './dataset/val/'  # 指定检测用的数据集路径

运行detect.py可以查看检测结果

image-classification-pytorch's People

Contributors

present-cjn 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.