tensorflow / models

Models and examples built with TensorFlow
Other
77.16k stars 45.76k forks source link

Feature request random rotating object_detection API #2336

Open ArjanSchouten opened 7 years ago

ArjanSchouten commented 7 years ago

System information

Situation: I'm using the object detection API to detect features on images. The problem I work on is not focused on photograph but on more structural images. My training set now contains around 500 images. The accuracy has increased a lot since I added some data augmentation options.

The results I see so far are promising. For the same boxes with a horizontal feature it is working perfect. For the same box vertical it is failing. My training set contains them both.

Feature request: I was wondering if it can be improved by randomly rotating the input images to fix some of the not detected vertical aligned boxes. Currently this preprocessing option does not exist in object_detection. Do you think adding an preprocessor feature for random rotation is helpful (is a PR useful)?

cy89 commented 7 years ago

@tombstone, (please feel free to redirect if you're not the right person), can you please comment on whether Arjan's suggestion would be helpful?

mpeniak commented 7 years ago

I'd love this feature too...currently using ssd-mobilenet trained to detect lots of vertical and very narrow features...it works pretty well already but with rotation data augmentation would work even better... how do I do that?

ArjanSchouten commented 7 years ago

I already started to work on this. Obviously I've only seen a decrease in accuracy, so I think I implemented something wrong ;)

If I have time I can send a WIP PR so people interested in this can review it and help me out if I have made an implementation mistake.

mpeniak commented 7 years ago

Hi Arjan,

Thanks for working on this. I would be definitely interested. Please keep me updates if you make any more progress!

Thanks!

evolu8 commented 6 years ago

Still not progressed? Is a PR helpful?

Rotation augmentation is very important for many (me included). Let me know if you need help.

apacha commented 5 years ago

One year since the last post. Has anyone implemented this yet?

ArjanSchouten commented 5 years ago

I tried this some time ago. I haven't made it ready for use yet (and I'm not in the position anymore to work on that code). Hope someone else is able to implement this!

averdones commented 4 years ago

The function random_rotation90 was added to core/preprocessor.py a few days after this issue was created. I don't know if this function existed somewhere previously.

Was the original intent of this issue the one of creating a random rotation of any amount of degrees, or the function random_rotation90 would solve the issue?

If it's the former, what do you think the best strategy would be? Having a single additional augmentation strategy that would generate a random angle every time, or multiple additional functions with, let's say, 45 degrees, 30 degrees, 10 degrees, etc.?

pigubaoza commented 4 years ago

The function random_rotation90 was added to core/preprocessor.py a few days after this issue was created. I don't know if this function existed somewhere previously.

Was the original intent of this issue the one of creating a random rotation of any amount of degrees, or the function random_rotation90 would solve the issue?

If it's the former, what do you think the best strategy would be? Having a single additional augmentation strategy that would generate a random angle every time, or multiple additional functions with, let's say, 45 degrees, 30 degrees, 10 degrees, etc.?

I believe it is the former. To me, the best strategy would be to have a single additional augmentation strategy that would generate a random angle every time, within a defined upper and lower boundary.

denisb411 commented 4 years ago

Still not implemented... It would save me a lot. Planning to use https://github.com/aleju/imgaug instead.

pigubaoza commented 4 years ago

Still not implemented... It would save me a lot. Planning to use https://github.com/aleju/imgaug instead.

I have been using aleju/imgaug for classification tasks and they work very well. Are you simply using it to augment your dataset, then converting them to tfrecords, and then using the Object Detection API?

Any ideas on how to easily use it for training with the Object Detection API, while having imgaug generate endless variations of images? The API takes in a simple protobuf configuration file, with the path to the tfrecord, and a lot of code changes have to be done to do this "online augmentation" during training.

JinLuckyboy commented 4 years ago

Use it. https://github.com/JinLuckyboy/TensorFlowObjectDetectionAPI-with-imgaug

I think, I seem to be able to make "online augmentation".

HoseinHashemi commented 2 years ago

This is apparently not yet implemented. Any updates?