运行CALC2.0

        CALC2.0是一个回环检测的论文,综合外观和语义进行回环检测。


目录

一、下载coco stuff 2017数据集,并放置到合适的文件夹(coco/images coco/annotations):

二、安装一个使用coco数据集的库:需要下好数据集再安装

三、安装coco.py需要的库:mrcnn

四、看看CALC2.0内dataset里的coco.py文件,一个用到的类

五、使用CALC2.0内dataset里的gen_tfrecords.py文件

五、运行calc2.py文件


一、下载coco stuff 2017数据集,并放置到合适的文件夹(coco/images coco/annotations):

        这一步我参考了几个教程比较乱,最好还是4个文件全部下载好解压,全的时候才不会出问题。能直接网站下载最好,百度网盘的未必准确。

        可以命令行下载,也可以直接网上官网或者百度网盘找一个下载,下载2017年的train2017.zip、val2017.zip和annotations_trainval2017.zip(后面命令行下载的annotation好像一问题。建议官网或者网盘下载)

http://images.cocodataset.org/zips/train2017.zip
http://images.cocodataset.org/annotations/annotations_trainval2017.zip

http://images.cocodataset.org/zips/val2017.zip
http://images.cocodataset.org/annotations/stuff_annotations_trainval2017.zip

http://images.cocodataset.org/zips/test2017.zip
http://images.cocodataset.org/annotations/image_info_test2017.zip
        前四个都下,分别放coco/images和coco/annotations

        一、三下载好直接解压到coco/

        二、四解压到coco/annotations

         train2017\val2017和annotations存放解压的数据;cocostuff是后面代码用来下载数据集的,如果用命令行下载会下载zip到里面的downloads文件夹;coco文件夹是第二部分的一个调用coco数据集的库。

        (有教程创建images存放train2017\val2017,但是这个系统运行直接放在coco文件夹下面)

 

        (annotations里train2017和val2017是忘记哪个教程下下来的了,感觉未必有用,正常四个下载了解压就行) 

# Get this repo
git clone https://github.com/nightrome/cocostuff.git
cd cocostuff

# Download everything
wget --directory-prefix=downloads http://images.cocodataset.org/zips/train2017.zip
wget --directory-prefix=downloads http://images.cocodataset.org/zips/val2017.zip
wget --directory-prefix=downloads http://calvin.inf.ed.ac.uk/wp-content/uploads/data/cocostuffdataset/stuffthingmaps_trainval2017.zip

# Unpack everything
mkdir -p dataset/images
mkdir -p dataset/annotations
unzip downloads/train2017.zip -d dataset/images/
unzip downloads/val2017.zip -d dataset/images/
unzip downloads/stuffthingmaps_trainval2017.zip -d dataset/annotations/


二、安装一个使用coco数据集的库:需要下好数据集再安装

https://github.com/waleedka/coco
下载好数据集后,进入对应环境(后面需要tensorflow1.13,所以需要一个有tensorflow1的环境)。运行PythonAPI文件夹内setup.py文件
终端输入:
 

pip install .

可能报错:ModuleNotFoundError: No module named 'Cython'
解决:

pip install cython

简介:
MS COCO API - http://mscoco.org/

Microsoft COCO is a large image dataset designed for object detection, segmentation, and caption generation. This package provides Matlab, Python, and Lua APIs that assists in loading, parsing, and visualizing the annotations in COCO. Please visit http://mscoco.org/ for more information on COCO, including for the data, paper, and tutorials. The exact format of the annotations is also described on the COCO website. The Matlab and Python APIs are complete, the Lua API provides only basic functionality.

In addition to this API, please download both the COCO images and annotations in order to run the demos and use the API. Both are available on the project website.
-Please download, unzip, and place the images in: coco/images/
-Please download and place the annotations in: coco/annotations/
For substantially more details on the API please see http://mscoco.org/dataset/#download.

After downloading the images and annotations, run the Matlab, Python, or Lua demos for example usage.

To install:
-For Matlab, add coco/MatlabApi to the Matlab path (OSX/Linux binaries provided)
-For Python, run "make" under coco/PythonAPI
-For Lua, run “luarocks make LuaAPI/rocks/coco-scm-1.rockspec” under coco/

三、安装coco.py需要的库:mrcnn

       不安装会报错

Error: ModuleNotFoundError: No module named 'mrcnn'

         一个别人的项目:

GitHub - matterport/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlowMask R-CNN for object detection and instance segmentation on Keras and TensorFlow - GitHub - matterport/Mask_RCNN: Mask R-CNN for object detection and instance segmentation on Keras and TensorFlowhttps://github.com/matterport/Mask_RCNN

        下载到本地文件夹:

git clone https://github.com/matterport/Mask_RCNN.git

        进入文件夹,进入对应conda环境,终端输入: 

pip install .

四、看看CALC2.0内dataset里的coco.py文件,一个用到的类

        看看就行,运行不用。实际gen_tfrecords.py文件主要还用的这个类

五、使用CALC2.0内dataset里的gen_tfrecords.py文件

        需要改一下数据集地址

        在calc2.0/dataset 文件夹内打开终端,进入有tensorflow1.x的conda环境,运行:

python gen_tfrecords.py

        时间挺久的。等运行完,就是官网说的: Doing this will generate the sharded tfrecord files as well as loss_weights.txt

五、运行calc2.py文件

        默认文件是训练模式,需要注意修改一下里面的路径部分。

        首先训练:

python calc2.py

        默认生成模型在自动创建的model文件夹

        注意:tensorflow最好还是1.13.1或者高点的,1.11.0可能会报错:AttributeError: module 'tensorflow.data' has no attribute 'experimental'

        如果numpy按照默认的高于1.17, 也会报一个warnning,可以降到1.16.x 

猜你喜欢

转载自blog.csdn.net/weixin_43907136/article/details/129883139