this post was submitted on 13 Aug 2023
9 points (90.9% liked)

LocalLLaMA

2244 readers
1 users here now

Community to discuss about LLaMA, the large language model created by Meta AI.

This is intended to be a replacement for r/LocalLLaMA on Reddit.

founded 1 year ago
MODERATORS
 

I'm really sorry that this is probably out of place, as it's not strictly LLAMA, but I couldn't think of anywhere else to post it where people may be able to help.

**Sadly, my grandma passed away yesterday. **It prompted me to retrieve some old photos that my parents stashed in the loft over a decade ago, and they are just incredible! I've found so many pictures of her, going back to when she was really young, to a point where I'll have to check if they are all definitely her! But there's amazing ones of my dad and uncles when they were little, even my nan with my dad and me when I'd literally just been born!

There's lots of really wonderful family moments and slice-of-life history captured there, and I don't think anyone knows they exist.

Mostly, I have enough funny photos to have birthday cards sorted for the several lifetimes!

I want to get these ALL scanned and digitised. But for now, I'm separating out ones with my nan in them to be top priority. Most of the services available have long turnarounds and, while the prices are far from extortionate, I'm looking for something which prices by the KG. Seriously, there must be over 20Kg of photo in here. They're mostly 6x4, so you'd want to have them done at a high DPI, the cost would be astronomical, especially as I already plan to spend a lot on printing.

So, I'd like to do this myself. I've dabbled with some LLM stuff, but I don't really know where to start with image manipulation, and I don't really have time to figure it out, so I'm asking for some guidance.

The rough idea is:

  1. Scan photos on high DPI flatbed scanner. Fill up the bed each time with multiple photos for highest speed

  2. 'Parse' the scan into multiple image files by identifying where the bounds are and cropping. This should be pretty simple. I think this may be possible in OpenCV? I've never tried before. Otherwise, it has to be one of the simpler jobs for a ML tool. I understand how object recognition works in principle, but not practice.

  3. Run select images through an upscaler. Some we may want to display or print larger, and if it's not unreasonable, if we're going to digitise them, may as well make them as high res as we can (I'll keep the originals). I know the usualy 'zoomify' caveats, but obviously when I'm starting with 6x4 images, I'll take all the help I can get.

  4. Ideally attempt to 'clean up' the images. I don't think I'd want to colourise anything, but it would be nice to remove obvious stains, creases and such from the print.

  5. The plan is to have some albums for people to go through at the wake, print off plenty of extra 6x4 copies so people can just grab them and take them away, but I'll also stick them all on a google drive or something and make the link available so people can download them in higher res, and more people will be able to see and preserve them

My main concern is 2 and 3. 4 would be a bonus. I suspect the shortlist will be 100-200 photos, but processing everything will be an ongoing process. I just want the shortlist done before the funeral.

I'd really rather run locally if viable. I have a two machines that may be able to contribute:

Workstation

  • RTX 3090 -32Gb DDR4 --> 64GB DDR5
  • 5600x. --> 7900x

I'm actually planning an upgrade very soon, which I can push through fast if it will help.

R720XD

  • 128GB DDR3 RAM
  • 2x E5-2630 v2.

Probably not super useful, but has lots of RAM, and can be used as a slow workhorse. My workstation is on CAD for 8 hours a day, and is used for gaming in the evening. I can obviously cut out the gaming, but not the CAD, so there could be some utility in handing off some things to the server, if the workload doesn't require GPU.

If you can point me in the right direction to get set up, that would be awesome. I'm new at this and learning fast, but I don't want to under-deliver. I'm very capable of learning the details, but I don't have enough experience to determine the 'best way' of doing something like this.

Any help would be incredible!

you are viewing a single comment's thread
view the rest of the comments

No ML necessary. I've done similar jobs like this before, and the workflow is roughly:

  1. Identify and crop each photo from the sheet. In my case I did this manually but it should be easy to do with OpenCV (can't help you there as I've never done anything with OpenCV myself). Of course you know the expected resolution and aspect ratio, so you could flag any photos that fall outside of this as "not straight" or "not 6x4" so that you can go back and check what's up with them. You definitely want to make sure that all your output images are the exact same size (in pixels), which should be the DPI of your scanner multiplied by the size (in inches) of your photos.

  2. For black and white photos: Remove any saturation so that they are "true" black and white and don't have a color tint.

  3. For color photos: Do automatic white balance adjustment. If the photos have a strong color tint due to age (e.g. pink) then you may need to tweak it manually (or use software/algorithm/plugin intended specifically to correct this tint).

  4. Perform automatic exposure correction.

  5. After this, apply any upscaling and noise/damage removal that you want.

I recommend saving your raw sheets, your processed output after step 4, and your final output after step 5. Step 5 is the one to look at or give to people. Step 4 is the one to go back to if you discover a better damage removal algorithm later on. The raw sheets is the one to go back to if you later discover a mistake in your cropping, or if you want to redo the color processing, or anything else that you've done to the images after they were scanned. You don't need to save the outputs of the other steps.

For steps 3 and 4 you should use software that is designed for photographers who are processing digital photos. e.g. Adobe Lightroom, RawTherapee, Darktable. These programs will allow you to open a scanned photo and process it the exact same way that you would process a raw photo taken by a digital camera if you were a photographer. If you aren't a photographer then you can use the "auto" settings and the program will do (roughly) the same as what your smartphone camera does to the raw image data when you take a photo today (that is, make the lighting and color balance look "correct").