用selective search方法提取候选框最简单的方法
1、根据如下github连接下载相关文件,并安装相应包
https://github.com/AlpacaDB/selectivesearch
2、运行example文件中运行脚本 example.py
# -*- coding: utf-8 -*-
from __future__ import (
division,
print_function,
)
import skimage.data
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import selectivesearch
from skimage import io
def main():
# loading astronaut image
# img = skimage.data.chelsea()
img = io.imread('/Users/zhouyang/rcnnCode/selectivesearch-develop 2/738.jpg')
# perform selective search
img_lbl, regions = selectivesearch.selective_search(
img, scale=20, sigma=0.9, min_size=10)
candidates = set()
for r in regions:
# excluding same rectangle (with different segments)
if