机器学习框架 caffe 是否支持不同的数据类型精度?



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

--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"

在我将每个浮点数更改为分类加倍之后.cpp。我希望我可以用更长的计算时间获得类似的精度。但是,我确实获得了更长的计算时间,但由于准确性看起来不正确,网络似乎不再工作。

--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更改为double不会更改存储的值,因此尝试将存储的单精度值读取为双精度结果,而您读取"垃圾"。您必须手动将文件转换为双精度值

最新更新