Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROIMaskHead returns empty proposal tensors #13

Open
ashnair1 opened this issue Dec 18, 2019 · 5 comments
Open

ROIMaskHead returns empty proposal tensors #13

ashnair1 opened this issue Dec 18, 2019 · 5 comments

Comments

@ashnair1
Copy link

ashnair1 commented Dec 18, 2019

❓ Questions and Help

I was able to train the rotated maskrcnn on my dataset. Note that my object contains small objects. However at some point in the code, it returns mask (selected_mask) as a tensor of shape [0, 1, 28, 28]. This was also the case for features and labels.

Initially I thought it was caused by images with no annotations. But I've checked to see that's not the case. It could be possible that the code is filtering out my objects because they're so small and thus resulting in an empty image.

So I guess my questions are:

  1. Does the code filter out object below a certain size?
  2. Can the code handle images with no annotations?
@mrlooi
Copy link
Owner

mrlooi commented Dec 19, 2019

  1. Does the code filter out object below a certain size?
    Not explicitly, but in general you want to make sure that the object is big enough to at least fit into the receptive field of the conv net. Too small e.g. area of 30 pixels only, will not be possible in many proposal-based conv net architectures
  2. Can the code handle images with no annotations?
    I'm guessing you mean during training? If there are no annotations in an image, the training script skips it (if I remember correctly)

@ashnair1
Copy link
Author

ashnair1 commented Dec 19, 2019

  1. Does the code filter out object below a certain size?
    Not explicitly, but in general you want to make sure that the object is big enough to at least fit into the receptive field of the conv net. Too small e.g. area of 30 pixels only, will not be possible in many proposal-based conv net architectures
  2. Can the code handle images with no annotations?
    I'm guessing you mean during training? If there are no annotations in an image, the training script skips it (if I remember correctly)
  1. Couldn't I use smaller anchors to address that?

I noticed that in the step x = self.feature_extractor(features, proposals), x is an empty tensor. So I looked into its inputs: features and proposals. The features looked fine, but the proposals were empty tensors. Following this I looked into keep_only_positive_boxes. This function filters out proposals with label = 0. But in my current example, all proposals were label = 0. This results in zero proposals. This in turn causes x to be zero which cause the selected_mask to be empty and finally fails in the maskiou_head's forward function.

@mrlooi Do you have any advice on how to deal with this problem?

@mrlooi
Copy link
Owner

mrlooi commented Dec 30, 2019

How small or big are your proposals? You can't use smaller anchors if they are already too small to fit into a convnet receptive field. Do read up about receptive fields and what that would mean when designing anchors and neural networks.

@ashnair1
Copy link
Author

ashnair1 commented Dec 31, 2019

Well the dataset I have is of satellite imagery (DOTA dataset) where object areas can vary widely between 3^2 pixels (like vehicles) and 712^2 pixels (like stadiums). Since using the FPN backbone locks the number of anchors that can be used to 5 which should also increase in powers of 2, I set ANCHOR_SIZES = (8, 16, 32, 64, 128).

@ashnair1 ashnair1 changed the title ROIMaskHead returns empty tensors ROIMaskHead returns empty proposal tensors Dec 31, 2019
@trungpham2606
Copy link

trungpham2606 commented Feb 26, 2020

@ashnair1
Have u solved this issue ? Iam also having this issue.
The weird thing is that the problem comes from this PPC dataset.
hmmmmmm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants