GithubHelp home page GithubHelp logo

cat_dog_classify's Introduction

cat_dog_classify

it's a simple project based on Pytorch which can classify whether an image is a cat or a dog

超参数选择

一共训练了30个epoch,batchsize设定为100。

使用Adam算法进行优化,learning_rate选择为1e-3。

loss_function选择为交叉熵损失函数。

结果

部分epoch训练结果如下(训练平台autodl,RTX3090):

image-20230711102417459.png image1

最终测试集上测试出的结果(在本机上跑的,一块GTX1650):

image2

Training和Validation的loss曲线 loss

Training和Validation的Accuracy曲线

accuracy

divide_data.py

把原始猫狗数据集划分为训练集、验证集和测试集,比例为6:2:2。 数据集原始组织形式: 一共有猫图片:6000张,有狗图片:6000张。图片已经被命名为:0.1.jpg-0.6000.jpg(猫);1.0.jpg-1.6000.jpg(狗) 尺寸均为100x100

ResNet18.py

搭建用于图片分类的resnet18网络

Train.py

训练模型代码。模型训练的参数存储在params.pth中。

Pred.py

测试模型在测试集上的准确率代码。

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.