【问题标题】:Dataset Preparation for CaffeCaffe 的数据集准备
【发布时间】:2019-12-26 20:01:56
【问题描述】:

我是机器学习的新手,我是使用 caffe 框架准备人脸检测模型的新手。 我已经创建了我的数据,对其进行了排序。我创建了 train.txt 和 val.txt,其中三元分类和图像类也相应地在各自的存储库中移动了图片。

现在,当我为训练准备数据库时,我无法成功转换 lmdb 文件夹。我总是遇到问题。

首先我认为我的路径不正确,但我尝试了所有方法,但仍然遇到错误。这是错误和代码的图片。

谁能帮我解决这个问题。

我运行以下脚本来创建 lmdb (sh examples/FaceDetection/create_lmdb.sh)

    #!/usr/bin/env sh
    # Create the imagenet lmdb inputs
    # N.B. set the path to the imagenet train + val data dirs

    EXAMPLE=/home/hashim/caffe/examples/imagenet

    DATA=/home/hashim/Desktop/IVP/Face_6k

    TOOLS=build/tools

    TRAIN_DATA_ROOT=/home/hashim/Desktop/IVP/Face_6k

    VAL_DATA_ROOT=/home/hashim/Desktop/IVP/Face_6k

    # 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; then

      RESIZE_HEIGHT=256

      RESIZE_WIDTH=256

    else

      RESIZE_HEIGHT=0

      RESIZE_WIDTH=0

    fi



    if [ ! -d "$TRAIN_DATA_ROOT" ]; then

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

    fi



    if [ ! -d "$VAL_DATA_ROOT" ]; then

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

    fi



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



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



    echo "Done."

我得到以下输出:

正在创建火车 lmdb...

    I1226 10:25:36.794904  3324 convert_imageset.cpp:86] Shuffling data

    I1226 10:25:36.795342  3324 convert_imageset.cpp:89] A total of 3602 images.

    F1226 10:25:36.796409  3324 db_lmdb.cpp:13] Check failed: mkdir(source.c_str(), 0744) == 0 (-1 
    vs. 0) mkdir /home/hashim/caffe/examples/imagenet/ilsvrc12_train_lmdb failed

    *** Check failure stack trace: ***

        @     0x7fe6b4bf20cd  google::LogMessage::Fail()

        @     0x7fe6b4bf3f33  google::LogMessage::SendToLog()

        @     0x7fe6b4bf1c28  google::LogMessage::Flush()

        @     0x7fe6b4bf4999  google::LogMessageFatal::~LogMessageFatal()

        @     0x7fe6b4febbe8  caffe::db::LMDB::Open()

        @     0x558490bb05e9  (unknown)

        @     0x7fe6b39f2b97  __libc_start_main

        @     0x558490bb186a  (unknown)

    Aborted (core dumped)



    Creating val lmdb...

    I1226 10:25:36.966315  3334 convert_imageset.cpp:86] Shuffling data

    I1226 10:25:36.966552  3334 convert_imageset.cpp:89] A total of 1197 images.

    F1226 10:25:36.966617  3334 db_lmdb.cpp:13] Check failed: mkdir(source.c_str(), 0744) == 0 (-1 vs. 0) mkdir /home/hashim/caffe/examples/imagenet/ilsvrc12_val_lmdb failed

    *** Check failure stack trace: ***

        @     0x7f999df730cd  google::LogMessage::Fail()

        @     0x7f999df74f33  google::LogMessage::SendToLog()

        @     0x7f999df72c28  google::LogMessage::Flush()

        @     0x7f999df75999  google::LogMessageFatal::~LogMessageFatal()

        @     0x7f999e36cbe8  caffe::db::LMDB::Open()

        @     0x5614b3ed95e9  (unknown)

        @     0x7f999cd73b97  __libc_start_main

        @     0x5614b3eda86a  (unknown)

    Aborted (core dumped)

    Done.

请帮我解决这个问题。谢谢。

【问题讨论】:

  • 您是否尝试过以管理员权限运行您的脚本?类似 chmod 777

标签: python caffe lmdb


【解决方案1】:

您的程序似乎正在尝试创建一个目录/home/hashim/caffe/examples/imagenet/ilsvrc12_train_lmdb,但它失败了。我建议检查以下内容:

  • 指向ilsvrc12_train_lmdb 的路径中的所有父目录是否都存在?
  • 如果父目录存在,运行脚本的用户帐户是否对所有父目录都具有正确的权限?权限是否足以允许该用户创建此目录?
  • 您是否尝试过在运行程序之前手动创建目录?您可以在mkdir 命令中使用-p 标志来创建任何缺少的中间目录:
mkdir -p /home/hashim/caffe/examples/imagenet/ilsvrc12_train_lmdb
  • 您是否尝试将EXAMPLE 设置为不同的目录?

不过,很可能是权限问题。

【讨论】:

  • 我已经尝试了所有方法,但仍然遇到相同的错误。该程序会创建 ilsvrc12_train_lmdb 目录,但不会将图像转换为 lmdb 格式。我猜是因为我没有足够的内存???
  • 因此,如果您运行rm -rf /home/hashim/caffe/examples/imagenet/ilsvrc12_train_lmdb 然后运行该脚本,您会得到与您发布的相同的错误输出,并且之后会重新创建该目录?因为错误消息的相关部分是Check failed: mkdir(source.c_str(), 0744) == 0 (-1 vs. 0) mkdir /home/hashim/caffe/examples/imagenet/ilsvrc12_train_lmdb failed,它告诉我目录没有成功创建。如果确实创建了目录,ls -ld /home/hashim/caffe/examples/imagenet/ilsvrc12_train_lmdb 的输出是什么??
猜你喜欢
  • 2015-10-09
  • 1970-01-01
  • 2019-01-02
  • 1970-01-01
  • 1970-01-01
  • 2017-11-24
  • 1970-01-01
  • 2019-09-30
  • 2021-06-17
相关资源
最近更新 更多