Code Monkey home page Code Monkey logo

dogbreed_gluon's Introduction

使用 gluon 实现狗品种分类

本项目是为了熟悉 gluon 操作的练手作,可以在测试集上获得0.28228的分数。

环境参考:

  • mxnet 0.12.1
  • numpy 1.13.3
  • tqdm 4.11.2
  • pandas 0.20.3
  • sklearn 0.19.0

思路

复现步骤分为以下几步:

Update

为了确定使用的预训练模型是否是最好的,我对所有预训练模型进行了迁移学习:

model val_loss
inceptionv3 0.296050225385
resnet152_v1 0.399359531701
resnet101_v1 0.410383010283
densenet161 0.418100789189
densenet201 0.453403010964
resnet50_v2 0.484435886145
resnet50_v1 0.496179759502
densenet169 0.512498702854
resnet34_v2 0.536734519526
vgg19_bn 0.557294445112
vgg16_bn 0.586511127651
resnet34_v1 0.591432901099
densenet121 0.591716498137
vgg19 0.619780953974
vgg16 0.669267293066
vgg13_bn 0.702507363632
vgg11_bn 0.708396691829
vgg13 0.756541173905
resnet18_v2 0.761708110571
vgg11 0.789955694228
resnet18_v1 0.832537706941
squeezenet1.1 1.6066500321
squeezenet1.0 1.62178872526
alexnet 1.77026221156

可以看到 densenet 并没有那么好,于是我只使用 inceptionv3 和 resnet152_v1 的特征,进行了融合迁移学习,获得了 0.27143 的分数。

Update

使用 Stanford Dogs Dataset 进行训练,使用了 inceptionv3 和 resnet152_v1,最终获得了 0.00398 的分数。

  • get_features_v3.ipynb 导出所有预训练模型输出的特征
  • stanford.ipynb 导出 Stanford Dogs Dataset 对应的特征,然后进行迁移学习,最后在测试集上进行预测

dogbreed_gluon's People

Contributors

ypwhs 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dogbreed_gluon's Issues

大佬想问您一下您的opencv库的版本

我在跑get_features_v3的时候跑第二段的如下第二行代码时候
img_224 = ((cv2.resize(img, (224, 224))[:,:,::-1] / 255.0 - mean) / std).transpose((2, 0, 1))#此行无问题
img_299 = ((cv2.resize(img, (299, 299))[:,:,::-1] / 255.0 - mean) / std).transpose((2, 0, 1))
下方的进度条跑到78%之后就会报错Canceled future for execute_request message before replies were done
我搜索了一下说可能是opencv2的版本问题,我更换了好几个版本,有时候卡到81% 有时候88% 但是就没有跑完的。我也尽量把我的版本更新到和您一样了,如
mxnet-cu101=1.5.0
numpy=1.13.3(sciipy=1.4.0)
tqdm=4.11.2
sklearn不知道为什么只有0.0.post1
如果您还记得的话恳请帮个忙,谢谢大佬

ps:感觉299是为了inceptionv3专门处理的,这条会报错就暂时不用这个模型跳过了

tqdm(data) error

my code went error when running for X,y in tqdm(data)
I have installed all dependence. But went error like following
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted (core dumped)

Have you ever met this error before?Thanks.

error: BadZipFile File is not a zip file

当我运行get_features.ipynb中的下面这一行:
features_vgg, labels = get_features(models.vgg16_bn(pretrained=True, ctx=ctx), data)
程序会运行很久之后便会出现错误BadZipFile File is not a zip file。程序运行时显示是从一个网址下载vgg16_bn-7f01cf05.zip文件,点开这个网址提示说这个xml网址并未包含关联信息,请问这个错误应该如何解决呢?

features shape

I am trying to run the model, but there's a error in this line:
features = np.concatenate([features_resnet, features_densenet, features_inception], axis=-1)
Error is caused by the inconsistent dimensions.

Then I check the shape of features_resnet, features_densenet, features_inception. Find that their shapes are not the same. I pretrain the features using the preprocessing file.

Error:The kernel appears to have died. It will restart automatically.

当我运行get_features.ipynb中的下面这一行:
features_vgg, labels = get_features(models.vgg16_bn(pretrained=True, ctx=ctx), data)

便会出现错误:The kernel appears to have died. It will restart automatically.

然后kernel 重启, 反复循环. Jupyter notebook错误日志:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc

应该不是GPU内存不足,我把前面一行:data = gluon.data.DataLoader(imgs, 64) 中的bach_size从64改成2还是报同样的错误. 系统内存也还没有用满,大概4G的样子. 请问这是怎么回事?谢谢

我的运行环境:
ubuntu16.04
mxnet1.0
硬件配置:
内存: 16G
gpu: gtx1080

gluon.data.ArrayDataset TypeError

使用你的代码运行时,

data_iter_224 = gluon.data.DataLoader(gluon.data.ArrayDataset(X_224), batch_size=batch_size)

查看资料,关于gluon.data.ArrayDataset需要两个参数 ?请问是什么问题

mxnet.gluon.data.ArrayDataset(data, label) link

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.