caffe 05 win10 运行examples的cifar10测试用例

    xiaoxiao2021-03-25  83

    01 资料

    caffe官网Examples中有关于cifar10测试的详细介绍。 http://caffe.berkeleyvision.org/gathered/examples/cifar10.html caffe github下载的代码中有关于cifar10的网络定义示例和下载数据sh文件。

    目录文件类型文件作用examples\cifar10*.prototxt网络定义文件examples\cifar10create_cifar10.sh生成lmdb的linxu shell脚本examples\cifar10readme.md等同于官网cifar10测试详细介绍examples\cifar10train_*.shlinxu下运行cifar测试的各种命令行脚本data\cifar10get_cifar10.sh获取测试数据linux shell脚本

    02 测试操作步骤

    02.01 下载测试数据

    根据examples\cifar10\readme.md文件说明。打开data\cifar10\get_cifar10.sh文件。

    #!/usr/bin/env sh # This scripts downloads the CIFAR10 (binary version) data and unzips it. DIR="$( cd "$(dirname "$0")" ; pwd -P )" cd "$DIR" echo "Downloading..." wget --no-check-certificate http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz echo "Unzipping..." tar -xf cifar-10-binary.tar.gz && rm -f cifar-10-binary.tar.gz mv cifar-10-batches-bin/* . && rm -rf cifar-10-batches-bin # Creation is split out because leveldb sometimes causes segfault # and needs to be re-created. echo "Done."

    可以看到测试数据下载地址:http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz。 这个是c++程序处理的数据包。 从http://www.cs.toronto.edu/~kriz/cifar.html页面可以找到三种测试数据压缩包。

    版本大小下载地址binary162 MBCIFAR-10 binary version (suitable for C programs)python163 MBCIFAR-10 python versionmatlab175 MBCIFAR-10 Matlab version

    把 http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz 保存在data\cifar10目录,并解压到data\cifar10\cifar-10-batches-bin。

    data\cifar10\cifar-10-batches-bin目录内文件batches.meta.txtdata_batch_1.bindata_batch_2.bindata_batch_3.bindata_batch_4.bindata_batch_5.binreadme.htmltest_batch.bin

    02.02 生成lmdb数据

    阅读caffe\examples\cifar10\create_cifar10.sh内容。这个是Linux下面生成lmdb数据库的脚本。

    #!/usr/bin/env sh # This script converts the cifar data into leveldb format. set -e EXAMPLE=examples/cifar10 DATA=data/cifar10 DBTYPE=lmdb echo "Creating $DBTYPE..." rm -rf $EXAMPLE/cifar10_train_$DBTYPE $EXAMPLE/cifar10_test_$DBTYPE ./build/examples/cifar10/convert_cifar_data.bin $DATA $EXAMPLE $DBTYPE echo "Computing image mean..." ./build/tools/compute_image_mean -backend=$DBTYPE \ $EXAMPLE/cifar10_train_$DBTYPE $EXAMPLE/mean.binaryproto echo "Done."

    其中convert_cifar_data.bin对应vs2015的工程中的exaples目录下的convert_cifar_data;compute_image_mean对应vs2015工程中的tools目录下的compute_image_mean。

    生成的可执行文件是 build\x64\examples\cifar10\Debug\convert_cifar_data-d.exe build\x64\examples\cifar10\Release\convert_cifar_data.exe build\x64\tools\Debug\compute_image_mean-d.exe build\x64\tools\Release\compute_image_mean.exe 如果运行了INSTALL,build\x64\install\bin下面也会有对应的文件。 为了使用方便,模拟create_cifar10.sh写一个windows版本的create_cifar10.bat。放在create_cifar10.sh相同目录下。(注意文本最好采用utf8格式保存)

    @echo off & setlocal enabledelayedexpansion :: examples\cifar10\create_cifar10.bat ::进入create_cifar10.bat所在磁盘 %~d0 ::进入create_cifar10.bat所在目录 cd %~dp0 :: 回到caffe根目录 cd ..\..\ :: 网络定义文件的位置,lmdb也生成在这里 set EXAMPLE=examples\cifar10 :: 测试数据的位置, set DATA=data\cifar10\cifar-10-batches-bin :: 工程文件生成的位置 ::set cfg=Debug ::set BUILD=build\x64\examples\cifar10\
    转载请注明原文地址: https://ju.6miu.com/read-37476.html

    最新回复(0)