4cat
4cat copied to clipboard
Cartographer and PixPlot Image preview
This is merge-able!
- Cartographer processor developed and functional; it allows, in principle, the creation of manifests (coordinate maps) that can be read and displayed by PixPlot. For the moment, I have it set to create a default grid mapping, but it should be easy to expand and add to if we would like to design different mappings.
- This basic grid mapping is now done automatically (via preset) on downloading images. It then is used as a preview allowing users to easily explore their downloaded images!
- I took and modified the PixPlot template and incorporated it into 4CAT. Primarily this means that it does not create a new static site (as PixPlot was designed) and instead loads them with our data (e.g., it uses the already downloaded images and templates instead of new hard-coded HTML files).
Notes:
- The
@app.route('/result/<path:query_file>')now can also load archived files. ~~This may not be the best design and we might perhaps not archive the images since they have this new use. Recommend reviewing this part.~~ Updated to open files and generate response on the fly.
To-do:
- Cartographer options can be expanded and make it a bit easier to integrate new mappings.
- ~~I have done some basic editing to the PixPlot template, but it could benefit from more work.~~ More editing done for 4CAT specific plots!
- Particularly making certain features optional such as the "Hotspots" and some of the icons both of which are not used by default.
- ~~Add metadata to the Image descriptions~~
- ~~Move the image description panel to one of the sides; it works where it is with the image filename only, but is not great/intuitive with further descriptions~~
- ~~edit add presets for tiktok and telegram image downloaders~~
- Updated the result endpoint to better handle archived files per Stijn's suggestions. They now open the file and stream it in the response.
- Updated how the preset (image downloader - cartographer) shows in the interface. It now "attaches to" the image downloader allowing quick downloading of the zip file but updates to how preview work allow the preview to show the plot (this works for all zips if a plot exists and now how as default zip view that lists files and links to them with the new result endpoint)
- Presets now link to the result file of an attached dataset. I updated
Dataset.delete()and thecleanup_tempfilesworker to check thatresult_fileis not used by other datasets. I could not find any other relevant instances of deleting result files. - Made some other edits to the plot template in general.
Current results seem solid.
To-do:
- ~~Create presets for tiktok and telegram~~
- ~~Work out how to properly create metadata files~~
- Cartographer options
- ~~Fix bug with image thumbnail links when using the lasso and viewing selected (cannot find where those thumbnail links are being created)~~
Also, it would be nice to make this compatible with all image-generating/downloading processors, including 'Extract video frames'.
Also, it would be nice to make this compatible with all image-generating/downloading processors, including 'Extract video frames'.
Right now, I need the cartographer to understand what to do with subfolders of image groupings. Or perhaps iterate_archive_contents doesn't since the files are not found (possibly a mismatch between the temp_path yielded and where the file was actually extracted). I could unpack and os.walk in the cartographer, but I really hate that message as it does not work well with amount caps since the whole (often quite large) archive is unpacked anyway.
Regardless, I think we could do better than to just splash the images semi in order. They could be automatically categorized by the subfolders they are in for example (mimicking the scene timeline).
Also, it would be nice to make this compatible with all image-generating/downloading processors, including 'Extract video frames'.
Right now, I need the cartographer to understand what to do with subfolders of image groupings. Or perhaps
iterate_archive_contentsdoesn't since the files are not found (possibly a mismatch between the temp_path yielded and where the file was actually extracted). I could unpack and os.walk in the cartographer, but I really hate that message as it does not work well withamountcaps since the whole (often quite large) archive is unpacked anyway.Regardless, I think we could do better than to just splash the images semi in order. They could be automatically categorized by the subfolders they are in for example (mimicking the scene timeline).
Sorted out subfolder handling in cartographer. Works with the video-frames processor. Currently there is no usable .metadata.json file (looks to be copied over from higher level processor and does not have image filename references for post_ids to be extracted) so images have no descriptions. I did not do anything to categorize the images by scene. That's more complex as the categories are currently decided from the metadata (which does not exist). This would be a special case.
I merged master into cartographer again. Last week there were a few bugs. This week the only thing I saw was actually an issue with the master in that, if we allow unlimited images (e.g., max images is set to 0 in configuration), all the downloaders would use a max of 0 and thus always download all images!
There is this one super weird but and so far only visible on tiktok datasets...
I am not sure what's going on there, but it is only the thumbnails so I need to figure out why that is the case.
I merged master into cartographer again. Last week there were a few bugs. This week the only thing I saw was actually an issue with the
masterin that, if we allow unlimited images (e.g., max images is set to 0 in configuration), all the downloaders would use amaxof0and thus always download all images!There is this one super weird but and so far only visible on tiktok datasets...
I am not sure what's going on there, but it is only the thumbnails so I need to figure out why that is the case.
ok, ok. it actually just occurs when there are very few images. PixPlot itself fails if you have less than 12 (and our cartagrapher ignores/bypasses that). it seems to have to do with the zoom not being far enough away that it doesn't trigger the thumbnails. no idea how to fix or address... but yeah.
I am not sure what's going on there, but it is only the thumbnails so I need to figure out why that is the case.