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
Refactor effdet dataloaders wrapper and fix the image sizes passed to effdet #630
Conversation
…factor_dataloaders
Codecov Report
@@ Coverage Diff @@
## master #630 +/- ##
==========================================
+ Coverage 85.63% 85.68% +0.04%
==========================================
Files 149 149
Lines 3245 3242 -3
==========================================
- Hits 2779 2778 -1
+ Misses 466 464 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I'll take a look at this today =) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really really like these changes!!! I just suggested some very small changes.
Thanks a lot Pawel!
Co-authored-by: Lucas Vazquez <lucasgouvaz@gmail.com>
So as I changed |
targets["bbox"].append(bboxes) | ||
# convert to tensors | ||
batch_images = torch.stack(batch_images) | ||
batch_bboxes = [tensor(bboxes, dtype=torch.float32) for bboxes in batch_bboxes] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit more verbose, but I like the fact that we're passing dtype
explicitly here, specially because as you pointed out effdet
complains if the dtype is not what it expects
Oh this missing space in COCOMetric test keeps popping up, its really annoying, sometimes it passes others it doesn't. Any idea how to fix this for good? |
I know what this is related to, the original The tests are done using Again, pycocotools causing problems -.-' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latest change removing commas looks good!
Yes, I do have it locally. Waiting for resolution of those errors before merge? |
For the errors just remove the spaces |
I think we are set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!! We are all set indeed!! let's merge
I started working on a refactor of effdet dataloaders. I noticed many common parts in the
build_train_batch
,build_valid_batch
andbuild_infer_batch
and came up with an idea to unify this API. There is a main loop over all records in order to extract certain information about the image tensor: image itself, bboxes and labels, image sizes and scales. Whether we want to extract certain parameters depends on the train/valid/infer part.Main change is the
process_record
function that will be used in single iteration over all records (instead of doing it twice now, second time if we need to extract additional info not handled by the basebuild_train_batch
function).I also removed the tensor casting from the
process_record
function in order to improve code readability. The idea is to handle to_tensor casting bycollate_records
.This is a draft PR. Looking forward for your thoughts and suggestions!