欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

将自己数据集转化为lmdb格式

发布时间:2025/3/15 38 豆豆
生活随笔 收集整理的这篇文章主要介绍了 将自己数据集转化为lmdb格式 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

在caffe-master_github/examples/imagenet/路径下有convert_imagenet.sh文件,使用时有以下注意事项(注意点写在了代码注释里):

#!/usr/bin/env sh # Create the imagenet lmdb inputs # N.B. set the path to the imagenet train + val data dirsEXAMPLE=examples/imagenet DATA=data/ilsvrc12 TOOLS=build/toolsTRAIN_DATA_ROOT=/path/to/imagenet/train/ VAL_DATA_ROOT=/path/to/imagenet/val/# Set RESIZE=true to resize the images to 256x256. Leave as false if images have # already been resized using another tool. RESIZE=false if $RESIZE; thenRESIZE_HEIGHT=256RESIZE_WIDTH=256 elseRESIZE_HEIGHT=0RESIZE_WIDTH=0 fiif [ ! -d "$TRAIN_DATA_ROOT" ]; thenecho "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT"echo "Set the TRAIN_DATA_ROOT variable in create_imagenet.sh to the path" \"where the ImageNet training data is stored."exit 1 fiif [ ! -d "$VAL_DATA_ROOT" ]; thenecho "Error: VAL_DATA_ROOT is not a path to a directory: $VAL_DATA_ROOT"echo "Set the VAL_DATA_ROOT variable in create_imagenet.sh to the path" \"where the ImageNet validation data is stored."exit 1 fiecho "Creating train lmdb..."GLOG_logtostderr=1 $TOOLS/convert_imageset \--resize_height=$RESIZE_HEIGHT \--resize_width=$RESIZE_WIDTH \--shuffle \$TRAIN_DATA_ROOT \$DATA/train.txt \$EXAMPLE/ilsvrc12_train_lmdbecho "Creating val lmdb..."GLOG_logtostderr=1 $TOOLS/convert_imageset \--resize_height=$RESIZE_HEIGHT \--resize_width=$RESIZE_WIDTH \--shuffle \$VAL_DATA_ROOT \$DATA/val.txt \$EXAMPLE/ilsvrc12_val_lmdbecho "Done." 与50位技术专家面对面20年技术见证,附赠技术全景图

总结

以上是生活随笔为你收集整理的将自己数据集转化为lmdb格式的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。