nkwsy / Wildmile

Wildmile tools and information
https://hackathon-starter-2018.herokuapp.com
1 stars 3 forks source link

Adding Image references to DB and assigning to deployments #195

Open nkwsy opened 4 months ago

nkwsy commented 4 months ago

Camera data is synced from the local NAS to an S3 database. We would need to pull images from the S3 and assign them to the deployment by adding the _Id from the deploymentID to the media input. Current model for images are located in
models/cameratrap/Media.js

Currently in app/actions/UploadActions.js we are using the S3 api to upload images for plants and such. We would need to modify to pull images for cameratraps to then create mongo document about each image.

In most cases all of the photos from a deployment are in the same root folder. Might make sense to pull sample images from the folder and allow user to assign all images in that folder to a specific deployment. It could be made easier by pulling the the EXIF value for Date/Time Original and seeing what deployments start & end dates overlap with them. This will fail if the camera date was set incorrectly.

I see a few ways to achieve this, we can do one or multiple of these

  1. Use EXIF data on each image to guess which deployment it belongs. Follow folder path up and assign pics to certain deployment
  2. Use folder name to assign to certain deployment. Probably use the camera ID (like UR002) then assign to deployment that uses this camera ID. We could manually rename the folders from past uploads to assign to deployments
  3. Allow user to upload all photos from SD card on the deployment page to assign to proper deployment. Could use something like dropzone. Could help so people wouldn't need to go to office to upload. Might be as issue to upload 32gb + of files in the browser.
  4. This also could be something which is not done on the nextjs project but is achieved via a python script or something else to assign images to deployments.

The final consideration is we do not need to necessarily assign each image to a deployment immediately. They could be created and used for adding observations then assigned to deployment at a later time.

soleo commented 4 months ago

image

I think option 2 using a folder naming convention was the one discussed when Kate and Paul were in the office recently. So I felt that would be great to implement as 1st iteration.

nkwsy commented 4 months ago

A few things to consider on the folder structure,

  1. The folder name might be 2024-06-15_UR011 but the image paths will be something like 2024/2024-06-15_UR011/DCIM/100MEDIA/SYFW0174.JPG
  2. some cameras there might be 100MEDIA and 101MEDIA if there are too many images, which will then have duplicates of the image name in each folder, so just pulling all jpg to a top level folder won't work w/o renaming some things. Could make SdUploader just upload images sequentially, or combine folder w/ image title.
  3. Some cameras have lower res thumbnails that go along with them. IE 2024/2024-01-30_prologis_02/DCIM/THUMB/sendlist/W1000235.JPG which will cause duplicates

Definitely could be sorted but a consideration. Basically comes down to either doing the logic on the SdUploader / local server end before it sends to S3 or building that into the node logic. I think it would make sense to just run some sort of REGEX on the path to pull out what the deployment level folder is and in the mongo document for the image the URI link is arbitrary. But I can also see an argument the other way.

Either way I have no strong feelings one way or another, but wanted to call this out