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

Thumbnail Handling #149

Merged
merged 9 commits into from
Mar 19, 2019
Merged

Thumbnail Handling #149

merged 9 commits into from
Mar 19, 2019

Conversation

AdanMora
Copy link
Contributor

@AdanMora AdanMora commented Mar 18, 2019

Hi @jsbroks

This is the patch for the thumbnail handling, I try to be clean and organized taking into account that is not my code, so I had to figure out where to make the changes, this includes the git and docker ignores and paths to the config file and database.

This is how works:

  • When you a new dataset, a new folder is created in the folder /thumbnails with the dataset name, to handle the deletions easily.

  • When you create a new annotation, the next time you load the dataset, the thumbnail will be created and store at the corresponding path using the id.

  • I include the flag is_modified in ImageModel, this flag lights up when a new annotation is made on a image already with annotations, this force to calculate the thumbnail again, maintaining the feature of previewing the annotations.

  • When any annotation is deleted, the thumbnail image is deleted from the folder, this covers to cases, when the image has no more annotations, the image must be deleted in order to keep space in disk; or when the image has more annotations forcing to get a new image.

  • I add into undo.py the cascade delete for the thumbnails when a image is deleted, also I fixed the bug when you delete a dataset and the folder remains in disk (/datasets), the deletion of thumbnails at dataset level is included as well.

  • I made two new methods in ImageModel to handle this feature.

This is a first approach, maybe is more convenient make some changes in other files, I'm not sure. Other features pro performance could be:

  • The user can change ho many images will be load per page (number picker).
  • The user chooses if he wants to reload the thumbnails instead of automatically.

Thanks.

EDIT: Note that the thumbnail is not make automatically when you import coco annotations, also when the image has no annotations available, it's important to cover these situations, can you guide me where to do it?

Resolves #92

Copy link
Owner

@jsbroks jsbroks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

To enable generation of the image when import COCO, the image flag would have to be set here. As for generating a thumbnail with no annotations should already be handled the way it is currently setup.

app/api/annotations.py Outdated Show resolved Hide resolved
app/models.py Outdated Show resolved Hide resolved
@jsbroks
Copy link
Owner

jsbroks commented Mar 19, 2019

I've made quite a few changes, take a look, test it out and let me know.

@AdanMora
Copy link
Contributor Author

I have to change the flag method, the previous version always calculates the thumbnail, it seems to be the flag, so now is not automatically change, you have to pass the new value to the method, now it works.

Also, there is a crash when I delete and image and then I go to the Undo tab, it crashes, look the error message:

bug

The line numbers match with this finale version. Seems like the image is deleted before undo.

app/api/images.py Outdated Show resolved Hide resolved
app/models.py Outdated Show resolved Hide resolved
app/models.py Outdated Show resolved Hide resolved
app/api/annotator.py Show resolved Hide resolved
@AdanMora
Copy link
Contributor Author

Ready, let me know about the bug and other corrections on the code.

@jsbroks jsbroks merged commit efd0571 into jsbroks:master Mar 19, 2019
jsbroks added a commit that referenced this pull request Mar 19, 2019
@AdanMora
Copy link
Contributor Author

@jsbroks Hi, did you update the docker image with this feature? I have updated my version and it doesn't store the thumbnails.

@jsbroks
Copy link
Owner

jsbroks commented Mar 22, 2019

Which build image are you using? I haven't pushed it to the stable tag yet, only latest.

@AdanMora
Copy link
Contributor Author

How can I check that? (sorry)

@jsbroks
Copy link
Owner

jsbroks commented Mar 22, 2019

In the docker-compose.yml on your local clone, does it say image: jsbroks/coco-annotator:stable or image: jsbroks/coco-annotator:latest

@AdanMora
Copy link
Contributor Author

Ohhh ok, it works! But I found a little bug, now the fill color when you use the brush is solid, it wasn't transparency.
image

@jsbroks
Copy link
Owner

jsbroks commented Mar 22, 2019

An issue has been opened, #161 and was caused when I fixed #151 .
The latest build generally mores bugs

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

Successfully merging this pull request may close these issues.

precreate/cache thumbnails
2 participants