rbgirshick / py-faster-rcnn

Faster R-CNN (Python implementation) -- see https://github.com/ShaoqingRen/faster_rcnn for the official MATLAB version
Other
8.1k stars 4.11k forks source link

Anchors not successfully generated using custom dataset #708

Open cpagravel opened 6 years ago

cpagravel commented 6 years ago

I am trying to train on a custom image set that is very wide in comparison to its height. The error I am getting is:

Traceback (most recent call last):
  File "./tools/train_net.py", line 116, in <module>
    max_iters=args.max_iters,previous_state=args.previous_state)
  File "/home/paperspace/custom-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 164, in train_net
    model_paths = sw.train_model(max_iters)
  File "/home/paperspace/custom-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 105, in train_model
    self.solver.step(1)
  File "/home/paperspace/custom-faster-rcnn/tools/../lib/rpn/anchor_target_layer.py", line 137, in forward
    gt_argmax_overlaps = overlaps.argmax(axis=0)
ValueError: attempt to get argmax of an empty sequence

I've read some related issues on this:

I would like to know how I can get around this. My dataset contains many pictures that have wide and uncommon aspect ratios (though they all have about similar aspect ratios to each other).

cpagravel commented 6 years ago

The debug output just before crashing is:

im_size: (102.0, 1000.0)
scale: 0.660938560963
height, width: (7, 63)
rpn: gt_boxes.shape (2, 5)
rpn: gt_boxes [[  35.69068146   36.35161972  104.42829132   67.41573334    1.        ]
 [ 891.6060791    36.35161972  960.34368896   68.73760986    1.        ]]
total_anchors 3969
inds_inside 0
anchors.shape (0, 4)
zqdeepbluesky commented 6 years ago

@cpagravel hi,do you fix this problem?can you tell me how to solve it? thanks so much!!!!