-
Notifications
You must be signed in to change notification settings - Fork 180
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
COCO sample previews show multiple sample masks #26
Comments
So to implement my solution, I used a function for listing files in a directory, and I wrote a small function for stripping the annotation filename:
This results in my new base code looking like this:
However, now I have a new problem that may be related. When I look at my resulting json files, I have fewer annotations than I do images, despite confirming that each image has a matching annotation file (see attachment). @waspinator Do you think this is a naming/file matching thing again? Or is this an expected behavior I'm not quite getting? Thanks! |
I'm not sure what the deal is, but I set up my dataset as described in your guide. The json file generates fine, but when I generate several random previews, some of my samples have some technicolor nonsense going on.
By that I mean 11 masks (they happen to be consecutive masks in the index) are drawn/assigned over the one sample. I've checked the json file, and it looks like all these annotations have been assigned to the one sample for some reason. Each sample is named according to the suggested format, so I'm not sure what's up.
For example:
image filename: DSC_5409_1.jpg
annotation filename: DSC_5409_1_mask_1.png
image: MVI_0155_1107_140.jpg
annotation: MVI_0155_1107_140_mask_1.png
There's the same number of unique filenames under each directory, and I've stripped the extensions and "_mask_1" from the annotation filenames to ensure they match.
Anyone else have this problem?
===
To explain further, I have a source image, let's say MVI_0155_1107.jpg. This is sampled using a sliding window technique to produce x number of samples saved as MVI_0155_1107_#.jpg, with x going as high as 350 in some cases.
...ah, that's the problem. When it reaches images xx_3.jpg, and starts looking for annotations, it's going to pick up ANY annotations with 'xx_3' in the filename. So, if I have annotations with: xx_3, xx_30, xx_31, xx_32, xx_33, xx_34, xx_35, xx_36, xx_37, xx_38, and xx_39, that leaves me with 11 annotations assigned to one sample.
So it's a matter of improving how the script parses annotation filenames for comparison. I'll try something like this...
Now we can use the image filename to match to the appropriate annotation regardless of naming scheme.
There are probably better ways to do this, so please feel free to suggest! I'm not closing this yet because I haven't tested my method. :)
The text was updated successfully, but these errors were encountered: