BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
33.96k stars 18.72k forks source link

Convert_annoset return 0 images #6996

Open watermellon2018 opened 3 years ago

watermellon2018 commented 3 years ago

I want to create lmdb using convert_annoset. I wrote the script for this. But when i run it, the output in console: A total of 0 images. But When I use convert_imagenet, script working correct, but i solve the task of detection and i need annotation.

I have the folders for image and for annotation. The structures next:

-detection
   -- annotation
       --- 1.xml
       --- 2.xml
       ......
   -- images
       --- db
       --- train
            ---- 1.jpg
            .....
       --- val
              ---- 20.jpg
            .....
   -- create_image_db_detection.sh
   -- train.txt
   -- val.txt

Annotation structure next:

<annotation>
    <folder>my-project-name</folder>
    <filename>1.jpeg</filename>
     <path>/my-project-name/1.jpeg</path>
     <source>
           <database>Unspecified</database>
      </source>
      <size>
            <width>864</width>
            <height>480</height>
            <depth>3</depth>
       </size>
       <object>
              <name>person</name>
             <pose>Unspecified</pose>
             <truncated>Unspecified</truncated>
             <difficult>Unspecified</difficult>
             <bndbox>
                        <xmin>259</xmin>
                        <ymin>25</ymin>
                        <xmax>418</xmax>
                        <ymax>196</ymax>
             </bndbox>
       </object>
</annotation>

I thought that path to images not correct but for convert_imagnet all working, so i dont know what wrong. Path to annotation also correct i think. My script:

DB_FOLDER=/home/my_name/Desktop/detection/images/db
TOOLS=/home/my_name/Desktop/Caffe/caffe-jacinto/build/tools

ROOT_FOLDER=/home/my_name/Desktop/detection
TRAIN_DATA_ROOT=/home/my_name/Desktop/detection/
VAL_DATA_ROOT=/home/my_name/Desktop/detection/images/val/

RESIZE=true

if $RESIZE; then
    RESIZE_HEIGHT=224
    RESIZE_WIDTH=224
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_annoset \
    --resize_height=$RESIZE_HEIGHT \
    --resize_width=$RESIZE_WIDTH \
    --shuffle \
    $ROOT_FOLDER \
    $TRAIN_DATA_ROOT/train.txt \
    $DB_FOLDER/ilsvrc12_train_lmdb_MW

echo "Creating val lmdb..."

GLOG_logtostderr=1 $TOOLS/convert_annoset \
    --resize_height=$RESIZE_HEIGHT \
    --resize_width=$RESIZE_WIDTH \
    --shuffle \
    $ROOT_FOLDER \
    $VAL_DATA_ROOT/val.txt \
    $DB_FOLDER/ilsvrc12_val_lmdb_MW

echo "Done."

And also output to console:

Creating train lmdb...
I0323 17:40:53.776692 24771 convert_annoset.cpp:118] Shuffling data
I0323 17:40:53.884591 24771 convert_annoset.cpp:121] A total of 0 images.
I0323 17:40:53.885545 24771 db_lmdb.cpp:36] Opened lmdb /home/dinar/Desktop/kate/detection/images/db/ilsvrc12_train_lmdb_MW
Creating val lmdb...
I0323 17:40:54.109081 24777 convert_annoset.cpp:118] Shuffling data
I0323 17:40:54.216404 24777 convert_annoset.cpp:121] A total of 0 images.
I0323 17:40:54.217329 24777 db_lmdb.cpp:36] Opened lmdb /home/my_name/Desktop/detection/images/db/ilsvrc12_val_lmdb_MW
Done.