-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
7,294 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,17 @@ This is the unoffical version Feature Pyramid Network for Feature Pyramid Netwo | |
|
||
# results | ||
`FPN(resnet50)-end2end result is implemented without OHEM and train with pascal voc 2007 + 2012 test on 2007` | ||
merged rcnn | ||
|[email protected]|aeroplane|bicycle|bird|boat|bottle|bus|car|cat|chair|cow| | ||
|:--:|:-------:| -----:| --:| --:|-----:|--:|--:|--:|----:|--:| | ||
|0.788|0.8079| 0.8036| 0.8010| 0.7293|0.6743|0.8680|0.8766|0.8967|0.6122|0.8646| | ||
|
||
|diningtable|dog |horse|motorbike|person |pottedplant|sheep|sofa|train|tv| | ||
|----------:|:--:|:---:| -------:| -----:| -------:|----:|---:|----:|--:| | ||
|0.7330|0.8855|0.8760| 0.8063| 0.7999| 0.5138|0.7905|0.7755|0.8637|0.7736| | ||
|
||
|
||
shared rcnn | ||
|[email protected]|aeroplane|bicycle|bird|boat|bottle|bus|car|cat|chair|cow| | ||
|:--:|:-------:| -----:| --:| --:|-----:|--:|--:|--:|----:|--:| | ||
|0.7833|0.8585| 0.8001| 0.7970| 0.7174|0.6522|0.8668|0.8768|0.8929|0.5842|0.8658| | ||
|
@@ -14,6 +23,9 @@ This is the unoffical version Feature Pyramid Network for Feature Pyramid Netwo | |
|----------:|:--:|:---:| -------:| -----:| -------:|----:|---:|----:|--:| | ||
|0.7022|0.8891|0.8680| 0.7991| 0.7944| 0.5065|0.7896|0.7707|0.8697|0.7653| | ||
# framework | ||
megred rcnn framework | ||
![](merge_rcnn_framework.png) | ||
shared rcnn | ||
![](framework.png) | ||
`the red and yellow are shared params` | ||
# about the anchor size setting | ||
|
@@ -46,14 +58,22 @@ cd lib | |
make | ||
``` | ||
### train & test | ||
shared rcnn | ||
```bash | ||
./experiments/scripts/FP_Net_end2end.sh 1 FPN pascal_voc | ||
./test.sh 1 FPN pascal_voc | ||
``` | ||
megred rcnn | ||
```bash | ||
./experiments/scripts/FP_Net_end2end_merge_rcnn.sh 0 FPN pascal_voc | ||
./test_mergercnn.sh 0 FPN pascal_voc | ||
``` | ||
0 1 is GPU id. | ||
|
||
### TODO List | ||
- [x] all tests passed | ||
- [x] evaluate object detection performance on voc | ||
- [x] evaluate merged rcnn version performance on voc | ||
|
||
### feature pyramid networks for object detection | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# -------------------------------------------------------- | ||
# Faster R-CNN | ||
# Copyright (c) 2015 Microsoft | ||
# Licensed under The MIT License [see LICENSE for details] | ||
# Written by Ross Girshick and Sean Bell | ||
# -------------------------------------------------------- | ||
|
||
import caffe | ||
import yaml | ||
import numpy as np | ||
import numpy.random as npr | ||
from fast_rcnn.config import cfg | ||
from fast_rcnn.bbox_transform import bbox_transform | ||
from utils.cython_bbox import bbox_overlaps | ||
|
||
DEBUG = False | ||
|
||
class As_rois_MergeRcnnLayer(caffe.Layer): | ||
""" | ||
Assign object detection proposals to ground-truth targets. Produces proposal | ||
classification labels and bounding-box regression targets. | ||
""" | ||
|
||
def setup(self, bottom, top): | ||
layer_params = yaml.load(self.param_str_) | ||
self._batch_rois = cfg.TEST.RPN_POST_NMS_TOP_N | ||
|
||
# sampled rois (0, x1, y1, x2, y2) | ||
top[0].reshape(1, 5) | ||
top[1].reshape(1, 5) | ||
top[2].reshape(1, 5) | ||
top[3].reshape(1, 5) | ||
top[4].reshape(1, 5) | ||
|
||
def forward(self, bottom, top): | ||
# Proposal ROIs (0, x1, y1, x2, y2) coming from RPN | ||
# (i.e., rpn.proposal_layer.ProposalLayer), or any other source | ||
rois = bottom[0].data | ||
w = (rois[:,3]-rois[:,1]) | ||
h = (rois[:,4]-rois[:,2]) | ||
s = w * h | ||
k0 =4 | ||
s[s<=0]=1e-6 | ||
layer_indexs = np.floor(k0+np.log2(np.sqrt(s)/224)) | ||
|
||
layer_indexs[layer_indexs<2]=2 | ||
layer_indexs[layer_indexs>5]=5 | ||
|
||
rois_all =[] | ||
|
||
for i in range(4): | ||
index = (layer_indexs == (i + 2)) | ||
num_index = sum(index) | ||
if num_index == 0: | ||
rois_ = np.zeros((1*4, 5), dtype=rois.dtype) | ||
else: | ||
rois_ = rois[index, :] | ||
rois_all.append(rois_) | ||
|
||
|
||
rois = np.concatenate(rois_all,axis= 0) | ||
rois_p2 = rois_all[0] | ||
rois_p3 = rois_all[1] | ||
rois_p4 = rois_all[2] | ||
rois_p5 = rois_all[3] | ||
|
||
top[0].reshape(*rois.shape) | ||
top[0].data[...] = rois | ||
|
||
top[1].reshape(*rois_p2.shape) | ||
top[1].data[...] = rois_p2 | ||
|
||
top[2].reshape(*rois_p3.shape) | ||
top[2].data[...] = rois_p3 | ||
|
||
top[3].reshape(*rois_p4.shape) | ||
top[3].data[...] = rois_p4 | ||
|
||
top[4].reshape(*rois_p5.shape) | ||
top[4].data[...] = rois_p5 | ||
|
||
|
||
|
||
def backward(self, top, propagate_down, bottom): | ||
"""This layer does not propagate gradients.""" | ||
pass | ||
|
||
def reshape(self, bottom, top): | ||
"""Reshaping happens during the call to forward.""" | ||
pass | ||
|
||
|
||
|
Oops, something went wrong.