Monocular arbitrary moving object discovery and segmentation(Raptor,NG-RANSAC 安装) 代码复现

环境

https://github.com/michalneoral/Raptor

兼容Raptor和NG-RANSAC的安装版本参考我的另一篇博客
Raptor NGRANSAC兼容版

1.创建environment.yaml

name: raptor
channels:
  - pytorch
  - conda-forge
dependencies:
  - python=3.8
  - pytorch=1.9.0
  - torchvision=0.10.0
  - cudatoolkit=11.1
  - pip
conda env create -f environment.yaml
conda activate raptor

2.安装mmcv

pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
pip install mmdet==2.20.0

3.Raptor安装
安装前建议看一看setup.py 设置一下库的版本

from setuptools import setup, find_packages

print(find_packages())

setup(
    name='raptor',
    version='1.0',
    description='Raptor code by Michal Neoral',
    packages=find_packages(),
    install_requires=[
        'tqdm',
        'opencv-python==4.5.5.62',
        'imageio==2.13.5',
        'wandb',
        'pypng==0.0.20',
        'gdown==4.5.1',
        'kornia==0.5.3',
        'timm==0.8.2.dev0',
#        'numpy>=1.21',
#        'nptyping',
    ]#,
)

git clone https://github.com/michalneoral/Raptor
cd Raptor
pip install -v -e .

4.RAFT修改版安装

git clone https://github.com/michalneoral/raft_fork.git
cd raft_fork
pip install -v -e .

5.下载模型

cd raptor/weights
bash download_weights.sh

数据集

1.KITTI’15 Dataset Instance Motion Segmentation Extension

cd YOUR_kitti15_basic_training_OR_multiview_training_directory
gdown https://drive.google.com/uc?id=1tOvHlFfL0cNIVJNjg2iC6JXyXmELoH4R -O ./KITTI15_MSplus.zip
unzip KITTI15_MSplus.zip

数据结构

├── readme.txt
│   └── file with link to this repo
├── motion_segmentation_coco_format/
│   └── directory contating all evaluation COCO-format files for both KITTI'15 and KITTI'15 IMS Extension
├── obj_map_fg/
│   └── binary *.png maps for foreground/background segmentation - all moving instances as foreground
├── obj_map_moseg/
│   └── instance motion segmentation *.png maps
└── obj_map_valid/
    └── binary *.png masks of motion segmenation - motion edges and areas excluded by annotator 

2.DAVIS_Moving - COCO format

cd YOUR_davis_directory
gdown https://drive.google.com/uc?id=1gwet3yr7PVPVGcPUxKKounUuCRA39GA3 -O ./DAVISMoving_coco.zip
unzip DAVISMoving_coco.zip

数据格式

├── readme.txt
│   └── file with link to this repo
└── motion_segmentation_coco_format/
    └── directory contating all evaluation COCO-format files

测试

1.查看运行参数设定

python demo/inference_demo_raptor_sequence.py --help

在这里插入图片描述
这样说明环境安装好了

2.写一个run.sh脚本来运行(对应自己的数据集路径和输出路径)

python demo/inference_demo_raptor_sequence.py   \
    --gpuid 2   \
    --config_file configs/raptor/raptor.py  \
    --checkpoint_file weights/raptor_bmvc_2021.pth \
    --save_custom_outputs \
    --save_outputs \
    --input_dict /data/qinl/Dataset/DAVIS/DAVIS/JPEGImages/480p/bear \
    --output_dict result

测试结果
在这里插入图片描述

在这里插入图片描述

如果要处理数据集下的子集则需要使用如下格式

python demo/inference_demo_raptor_sequence.py
--gpuid #YOUR_GPU_NUMBER
--config_file configs/moseg/raptor.py
--checkpoint_file weights/raptor_bmvc_2021.pth
--save_custom_outputs
--save_outputs
--search_subdirs
--input_dict #PATH_TO_INPUT_DIRECTORY_WITH_SEQUENCE_OF_IMAGES_DIRECTORIES
--output_dict #PATH_TO_OUTPUT_DIRECTORY

评估

文件有点问题,改一下–config
在这里插入图片描述
在这里插入图片描述

这个文件是配置数据路径的
在这里插入图片描述

可以吧wandb去掉,不用它也行

用如下命令进行评估


python tools/test_with_wandb.py --config configs/raptor/raptor.py  --checkpoint weights/raptor_bmvc_2021.pth  --eval bbox segm

NG-RANSAC 安装

配环境

conda create -n ngransac python=3.6
conda activate ngransac
conda install pytorch==1.2.0 torchvision==0.4.0 cpuonly -c pytorch
pip install opencv-python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16
sudo apt-get install libopencv-dev
conda install libopencv
cd ngransac
python setup.py install

测试

python ngransac_demo.py -img1 images/demo1.jpg -fl1 900 -img2 images/demo2.jpg -fl2 900

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

玛卡巴卡_qin

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值