Giter Site home page Giter Site logo

detectionteamucas / r2cnn_faster-rcnn_tensorflow Goto Github PK

View Code? Open in Web Editor NEW
589.0 25.0 187.0 281.37 MB

Rotational region detection based on Faster-RCNN.

License: MIT License

Python 97.30% Makefile 0.01% C++ 0.06% Cuda 2.63%
r2cnn dota tensorflow face ocr faster-rcnn remote-sensing

r2cnn_faster-rcnn_tensorflow's People

Contributors

yangxue0827 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r2cnn_faster-rcnn_tensorflow's Issues

cfgs中的参数请教

你好,想问一下lib/configs/cfgs中的这两个参数:
IMG_SHORT_SIDE_LEN = 800
IMG_MAX_LENGTH = 1000
怎么用,因为我发现IMG_MAX_LENGTH参数貌似没有用到,所以想请教一些问题:
1)IMG_SHORT_SIDE_LEN可以随便设置吗?例如我有一批图片,最短边为200,必须设置为200吗?
2)如果我要在512*512的图片上面进行训练,这两个参数应该如何设置?
期待你的回复~

eval.py error

when I use the eval.py ,it throws

/media/heping/D/new/DOTA_MODEL/R2CNN_Faster-RCNN_Tensorflow-master/libs/val_libs/voc_eval_r.py:240: RuntimeWarning: invalid value encountered in true_divide
rec = tp / int(num_pos)
mAP is : nan

my image_dir is the results obtained from the demo_rh.py,test_annotation_path is the corresponding annotation. Is there any problem? Thank you. @yangxue0827

and the generated txt document:
P0003_0000_0000 0.980 599.5 273.6 26.5 108.3 -9.1
what"s the meaning of the last item? Is it h?

rotate_gpu_nms

I can't find model rotate_gpu_nms.py in bbx_utils package. Could you upload this model? Thanks~

Inference in c++

Hi, thanks for sharing your great work!

I'm trying to use your model in C++. After freezing it, I try to load the graph in C++ but I get the error "No OpKernel was registered to support Op 'PyFunc' with these attrs". Any idea how can I export it to C++?

请问您配置的环境的版本

您好,感谢您的分享。我想询问一下你的环境配置的各个版本。我使用的是tensorflow1.11,CUDA9.0,cudnn7.2.1,python2.7.12,但是我在inference.py时,出现下述问题:Traceback (most recent call last):
File "inference.py", line 127, in
inference(det_net, data_dir=args.data_dir)
File "inference.py", line 36, in inference
gtboxes_r_batch=None)
File "../libs/networks/build_whole_network.py", line 538, in build_whole_detection_network
img_shape=img_shape)
File "../libs/networks/build_whole_network.py", line 154, in postprocess_fastrcnn_r
use_gpu=cfgs.ROTATE_NMS_USE_GPU)
File "../libs/box_utils/nms_rotate.py", line 31, in nms_rotate
device_id=gpu_id)
File "../libs/box_utils/nms_rotate.py", line 101, in nms_rotate_gpu
Tout=tf.int64)
File "/home/dlmu/.virtualenvs/dl2cv/local/lib/python2.7/site-packages/tensorflow/python/ops/script_ops.py", line 457, in py_func
func=func, inp=inp, Tout=Tout, stateful=stateful, eager=False, name=name)
File "/home/dlmu/.virtualenvs/dl2cv/local/lib/python2.7/site-packages/tensorflow/python/ops/script_ops.py", line 253, in _internal_py_func
token = _py_funcs.insert(func)
File "/home/dlmu/.virtualenvs/dl2cv/local/lib/python2.7/site-packages/tensorflow/python/ops/script_ops.py", line 141, in insert
self._funcs[token] = func
File "/usr/lib/python2.7/weakref.py", line 108, in setitem
self.data[key] = KeyedRef(value, self._remove, key)
File "/usr/lib/python2.7/weakref.py", line 278, in new
self = ref.new(type, ob, callback)
TypeError: cannot create weak reference to 'builtin_function_or_method' object
Segmentation fault (core dumped)
看到你之前回答说要封装cython,能说的详细些吗?谢谢

Inference error

I compile the code and run inference in TF1.10.1, it reports

keep = tf.py_func(rotate_gpu_nms, inp=[det_tensor, iou_threshold, device_id], Tout=tf.int64)
*** TypeError: cannot create weak reference to 'builtin_function_or_method' object

Could you help? Thanks

Help?

Can you write down the entire training and testing process in detail and how to train other datasets(eg:ICDAR2015)? Thank you a lot.

multi_gpu_train.py error

 Hi, i want to speed up the experiment by using multi_gpu_train.py.However,there are some errors:
 TypeError: build_whole_detection_network() got an unexpected keyword argument 'gtboxes_batch'!!!
 In line 46 of  multi_gpu_train.py,the function of build_whole_detection_network have 2 inputs and return 4 outputs.But in line 387 of build_whole_detection_network.py, this function have 3 inputs and return 7 outputs,and there is no input named gtboxes_batch.
 I have found  the similar question in your github: https://github.com/DetectionTeamUCAS/RRPN_Faster-RCNN_Tensorflow/issues/5  .
 So how can i change the code? Thanks!!!

eval.py计算mAP报错

计算mAP一直报错
后来发现eval.py中103-104行只对x_c, y_c做了尺寸还原,w和h则没有,这是bug还是有意为之?
我注释掉103和104行,并对gtbox缩放,则计算mAP成功

reference_theta計算問題

I saw your code and find
reference_theta = np.ones(reference_xmin.shape) * -90
I don't understand the relationship between reference_theta and reference_xmin.
Can you explain what does this mean? Thanks a lot!

questions about the required annotation format

Hello,

Could you please provide additional information regarding training this network.
Specifically, I did not understand what is the required annotation format.

the instructions hint that Voc-pascal can/must be converted using convert_data_to_tfrecord.py
but I both :

a. do not understand this - as far as i can tell, voc supports bounding box annotation of the form minx miny maxx maxy , i.e. using only 2 points of data -> rectangle only.
while in order to support/describe the object's pose/orientation we need 4 data points (quadrilateral bounding boxes)...

b. was not able to do this - running convert_data_to_tfrecord.py on a valid voc xml file resulted in the following msg " Conversion is complete! " , yet the resulting file was empty.

c. could you suggest a suitable annotation tool ?
or simply state the one that you have used ?

Thanks,
Omer.

python3 camera_demo.py --gpu='0' error

python3 camera_demo.py --gpu='0'
++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--
/home/pythonocr/detection/ROTATED/R2CNN_Faster-RCNN_Tensorflow
Traceback (most recent call last):
File "camera_demo.py", line 16, in
from libs.networks import build_whole_network
File "../libs/networks/build_whole_network.py", line 19, in
from libs.detection_oprations.anchor_target_layer_without_boxweight import anchor_target_layer
File "../libs/detection_oprations/anchor_target_layer_without_boxweight.py", line 15, in
from libs.box_utils.cython_utils.cython_bbox import bbox_overlaps
ImportError: No module named 'libs.box_utils.cython_utils.cython_bbox'

Coordinate backward conversion

Hi,

I am wondering if this part will introduces some bugs https://github.com/DetectionTeamUCAS/R2CNN_Faster-RCNN_Tensorflow/blob/854fe56697132ef82b13e9570f077fcd9e6c6e78/libs/box_utils/coordinate_convert.py#L43

Because cv2 minRectArea gives us angles ranging from -90 to 0 degrees, which means some box will be rotated 90 degrees if we use this back_forward_convert func. Is this expected?

Any suggestion on fixing this?

Best,
Xin

代码和文章里的不一致

你好,repo的代码只是选取了resnet的最后一层作为特征,但是文章里说用了dense fpn的结构,请问这是为啥?没有开放嘛?
文章是Position Detection and Direction Prediction for Arbitrary-Oriented Ships via Multiscale Rotation Region Convolutional Neural Network @yangxue0827

what does PIXEL_MEAN mean?

Hi @yangxue0827, thank you and your team making this repository. Really appreciate it.
I am trying to read your code and confused about the meaning of PIXEL_MEAN. It was set to [123.68, 116.779, 103.939]. May I ask how you calculate these values and if we use our own dataset, do we need to calculate and update them?
I am trying to use my own dataset and it was contained by a group of gray images. I think the value of pixel_mean will influence a lot to its performance. Thank you in advance!

The unstablity of overlaps calculation

in your iou_rotate.py, there are two implements of overlaps calculation(GPU and CPU) , sometime the difference of the results calcuated by the two implemnts can not be ignored.

devRotateIoU in rbbox_overlaps_kernel.cu and rotate_polygon_nms_kernel.cu also has some difference, especailly the constraint in the function inrect

question regarding input image resize

hello,

could you please shed some light on the input image resize that's performed in read_tfrecord.py-read_and_prepocess_single_img-image_preprocess.short_side_resize.

firstly can you please explain why this is done ?

additionally, can you also please explain why you have provided the default value of cfg.py: IMG_SHORT_SIDE_LEN = 800

Thanks,
Omer

About accuracy

I have read the code in this repo and I found this code doesn't contain the DFPN, FPN, Adaptive ROI Align parts.
I find the code is a standard faster rcnn with a obb loss branch in Fast-RCNN part. Does this code can get about 60.x map on dota dataset?
Did you trained the model with inputs that is cropped from original images with 800*800 pixels and cropped overlaps is 200 pixeles?

Blended image reading and writing formats!

As shown in the train_crop.py and val_crop.py files, images are read by scipy.misc.imread(...) while the cropped patches are saved by cv2.imwrite(...). This will make the cropped patches saved with the completely reverse channels of original images. As a result, the following data transformation for tfrecord based on these operations and finally involved in the training process will make learned model not consistent with the original images. While images are read by the way of cv2.imread(...), as in inference.py, eval.py, in the prediction phases!

bug in training my own data

Hi,
Have you ever had this problem? How to solve it?Thanks.
2019-02-27 10:55:33.007891: W tensorflow/core/framework/op_kernel.cc:1158] Unknown: exceptions.KeyError: 2
2019-02-27 10:55:33.057396: W tensorflow/core/framework/op_kernel.cc:1158] Unknown: exceptions.KeyError: 2
[[Node: PyFunc_1 = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_15", _device="/job:localhost/replica:0/task:0/cpu:0"](Squeeze_1/_1363, postprocess_fastrcnn_r/Gather_4/_1365, postprocess_fastrcnn_r/Gather_6/_1367, postprocess_fastrcnn_r/Gather_5/_1369)]]
2019-02-27 10:55:33.057436: W tensorflow/core/framework/op_kernel.cc:1158] Unknown: exceptions.KeyError: 2
[[Node: PyFunc_1 = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_15", _device="/job:localhost/replica:0/task:0/cpu:0"](Squeeze_1/_1363, postprocess_fastrcnn_r/Gather_4/_1365, postprocess_fastrcnn_r/Gather_6/_1367, postprocess_fastrcnn_r/Gather_5/_1369)]]
2019-02-27 10:55:33.057453: W tensorflow/core/framework/op_kernel.cc:1158] Unknown: exceptions.KeyError: 2
[[Node: PyFunc_1 = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_15", _device="/job:localhost/replica:0/task:0/cpu:0"](Squeeze_1/_1363, postprocess_fastrcnn_r/Gather_4/_1365, postprocess_fastrcnn_r/Gather_6/_1367, postprocess_fastrcnn_r/Gather_5/_1369)]]
2019-02-27 10:55:33.635849: W tensorflow/core/framework/op_kernel.cc:1158] Unknown: exceptions.KeyError: 2
[[Node: PyFunc_1 = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_15", _device="/job:localhost/replica:0/task:0/cpu:0"](Squeeze_1/_1363, postprocess_fastrcnn_r/Gather_4/_1365, postprocess_fastrcnn_r/Gather_6/_1367, postprocess_fastrcnn_r/Gather_5/_1369)]]
2019-02-27 10:55:33.644552: W tensorflow/core/kernels/queue_base.cc:294] _1_get_batch/batch/padding_fifo_queue: Skipping cancelled enqueue attempt with queue not closed
2019-02-27 10:55:33.644611: W tensorflow/core/kernels/queue_base.cc:294] _0_get_batch/input_producer: Skipping cancelled enqueue attempt with queue not closed
Traceback (most recent call last):
File "/home/ubuntu/R2CNN_Faster-RCNN_Tensorflow/tools/train.py", line 213, in
train()
File "/home/ubuntu/R2CNN_Faster-RCNN_Tensorflow/tools/train.py", line 193, in train
_, global_stepnp, summary_str = sess.run([train_op, global_step, summary_op])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 789, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 997, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1132, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1152, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.UnknownError: exceptions.KeyError: 2
[[Node: PyFunc_1 = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_15", _device="/job:localhost/replica:0/task:0/cpu:0"](Squeeze_1/_1363, postprocess_fastrcnn_r/Gather_4/_1365, postprocess_fastrcnn_r/Gather_6/_1367, postprocess_fastrcnn_r/Gather_5/_1369)]]

Caused by op u'PyFunc_1', defined at:
File "/home/ubuntu/R2CNN_Faster-RCNN_Tensorflow/tools/train.py", line 213, in
train()
File "/home/ubuntu/R2CNN_Faster-RCNN_Tensorflow/tools/train.py", line 74, in train
scores=final_scores_r)
File "/home/ubuntu/R2CNN_Faster-RCNN_Tensorflow/libs/box_utils/show_box_in_tensor.py", line 238, in draw_boxes_with_categories_and_scores_rotate
Tout=[tf.uint8])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_ops.py", line 198, in py_func
input=inp, token=token, Tout=Tout, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_script_ops.py", line 38, in _py_func
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2506, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1269, in init
self._traceback = _extract_stack()

UnknownError (see above for traceback): exceptions.KeyError: 2
[[Node: PyFunc_1 = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_15", _device="/job:localhost/replica:0/task:0/cpu:0"](Squeeze_1/_1363, postprocess_fastrcnn_r/Gather_4/_1365, postprocess_fastrcnn_r/Gather_6/_1367, postprocess_fastrcnn_r/Gather_5/_1369)]]

Process finished with exit code 1

question about license

Is there any open-source license (e.g. MIT, apache ...) for this project ?
If you add the license, everyone will be able to use/cite your work easily.

没有train.py

您好,非常感谢您的贡献,我看了readme但是没发现有train的脚本,不知道您方便上传一下吗?

cuda8.0

Can I change cuda8.0 to cuda9.0?

tfrecord error

I ues the convert_data_to_tfrecord.py to transform the cliped data to tfrecord,the code shows complete,but the tfrecord file size is zero,and the path is right,what's the problem maybe?

blended image reading and writing format!

As shown in the train_crop.py and val_crop.py files, images are read by scipy.misc.imread(...) while the cropped patches are saved by cv2.imwrite(...). This will make the cropped patches saved with the completely reverse channels of original images. As a result, the following data transformation for tfrecord based on these operations and finally involved in the training process will make learned model not consistent with the original images. While images are read by the way of cv2.imread(...), as in inference.py, eval.py, in the prediction phases!

demo_rh.py

I python demo_rh.py , it shows the weight is 0,but I have put the trained weights file on the right place,what's the problem,,, It doesn't like this initially...

Training result not same as you

Thank you for your code! I trained the icdar2015 for using your code, I iterated 10w times, but i can't not get the result same as you. I modified the the anchor_scale to be [1/2, 1.] in the cfgs.py. Can you help me to slove this proplem or can you tell me how you to did when you train the icdar2015?

Computing results on DOTA test set

Could you please provide an example of how do you prepare result files on test set for the DOTA server by using your pre-trained R2CNN model?

train the icdar2015 datasets

最近我用师兄您在github上复现的R2CNN的代码,感觉师兄你写得很棒,在此表示尊敬和佩服,向师兄你学习!
我的想法是用ICDAR2015数据集来训练,然后再用于天池之前那个比赛的数据集来训练,虽然比赛期间没有做出来,后来一直不甘心,想把这个愿望实现。
我根据您github上的步骤来训练,我对ICDAR数据集也做了处理,把它做成了VOC的格式,但我不知做的是否正确,我将做好的Annotations可视化出来和
原本ICDAR中的gt_boxes的效果是一样的,xml中我给的(x0,y0, x1,y1, x2,y2, x3,y3)的顺序是顺时针方向的,根据您给的xml格式是顺时针的方向,但是训练出来的效果
和师兄你在github上给出的效果很差蛮大的,我在想是不是我数据集处理的时候出错,还是哪些参数没有调好,希望师兄,百忙中抽空回复我一下!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.