gpt4 book ai didi

image-processing - 机器学习框架caffe支持不同的数据类型精度吗?

转载 作者:行者123 更新时间:2023-11-30 08:58:01 24 4
gpt4 key购买 nike

我目前正在使用 CaffeNet C++ 图像分类示例。默认情况下,本示例使用 float。这是我得到的结果:

--cat--
Classification time: 0.8267 seconds
0.3134 - "n02123045 tabby, tabby cat"
0.2380 - "n02123159 tiger cat"
0.1235 - "n02124075 Egyptian cat"
0.1003 - "n02119022 red fox, Vulpes vulpes"
0.0715 - "n02127052 lynx, catamount"

--dog--
Classification time: 0.8259 seconds
0.4228 - "n02106662 German shepherd, German shepherd dog, German police dog, alsatian"
0.1344 - "n02109961 Eskimo dog, husky"
0.0914 - "n02091467 Norwegian elkhound, elkhound"
0.0642 - "n02110063 malamute, malemute, Alaskan malamute"
0.0532 - "n02110185 Siberian husky"

在我将classification.cpp中的每个 float 更改为双倍之后。我希望能够通过更长的计算时间获得类似的精度。然而,我确实得到了更长的计算时间,但似乎网络不再工作,因为精度看起来不正确。

--cat--
Classification time: 1.0368 seconds
0.0015 - "n04435653 tile roof"
0.0015 - "n04209239 shower curtain"
0.0014 - "n03530642 honeycomb"
0.0014 - "n03729826 matchstick"
0.0014 - "n04033901 quill, quill pen"

--dog--
Classification time: 1.0506 seconds
0.0015 - "n04435653 tile roof"
0.0015 - "n04209239 shower curtain"
0.0014 - "n03530642 honeycomb"
0.0014 - "n03729826 matchstick"
0.0014 - "n04033901 quill, quill pen"

我想知道 Caffe 框架是否支持不同的数据类型精度?是不是因为网络是使用 float 训练的,所以它不能与其他数据类型精度一起工作?

谢谢。

最佳答案

您在教程中使用的平均文件和训练参数以单精度值存储。在程序中将 float 更改为 double 不会更改存储的值,因此尝试将存储的单精度值读取为 double 结果,而您读取的是“垃圾”。您必须手动将文件转换为 double 值

关于image-processing - 机器学习框架caffe支持不同的数据类型精度吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51929852/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com