美文网首页
努力跑通ResNet

努力跑通ResNet

作者: 陈继科 | 来源:发表于2016-10-27 22:38 被阅读146次

    create_data.sh->creata_annoset.py->convert_annoset.cpp

    // This program converts a set of images and annotations to a lmdb/leveldb by
    // storing them as AnnotatedDatum proto buffers.
    // Usage:
    //   convert_annoset [FLAGS] ROOTFOLDER/ LISTFILE DB_NAME
    //
    // where ROOTFOLDER is the root folder that holds all the images and
    // annotations, and LISTFILE should be a list of files as well as their labels
    // or label files.
    // For classification task, the file should be in the format as
    //   imgfolder1/img1.JPEG 7
    //   ....
    // For detection task, the file should be in the format as
    //   imgfolder1/img1.JPEG annofolder1/anno1.xml
    

    这个classification测试可以跑通
    detecction要用xml暂时跑不通,因为:
    输出结构和他定义的不一致

    pretrain####

    在imagenet上pretrain,应该用 imgfolder1/img1.JPEG 7

    2101538450.jpg

    fine-tuning####

    在自己的数据集上fine-tuning,应该用annofolder1/anno1.xml

     if (anno_type == "classification") {
          label = boost::get<int>(lines[line_id].second);
          status = ReadImageToDatum(filename, label, resize_height, resize_width,
              min_dim, max_dim, is_color, enc, datum);
        } else if (anno_type == "detection") {
          labelname = root_folder + boost::get<std::string>(lines[line_id].second);
          status = ReadRichImageToAnnotatedDatum(filename, labelname, resize_height,
              resize_width, min_dim, max_dim, is_color, enc, type, label_type,
              name_to_label, &anno_datum);
          anno_datum.set_type(AnnotatedDatum_AnnotationType_BBOX);
        }
        if (status == false) {
          LOG(WARNING) << "Failed to read " << lines[line_id].first;
          continue;
        }
        if (check_size) {
          if (!data_size_initialized) {
            data_size = datum->channels() * datum->height() * datum->width();
            data_size_initialized = true;
          } else {
            const std::string& data = datum->data();
            CHECK_EQ(data.size(), data_size) << "Incorrect data field size "
                << data.size();
          }
        }
        // sequential
        string key_str = caffe::format_int(line_id, 8) + "_" + lines[line_id].first;
    

    具体怎么对应网络结构,待续。。。

    相关文章

      网友评论

          本文标题:努力跑通ResNet

          本文链接:https://www.haomeiwen.com/subject/gbpsuttx.html