Sort a folder of wildlife photos (birds, dolphins, whales) by how sharp the animal is. Each photo moves into A_sharp/, B_soft/, C_blurry/ or D_no_animal/ inside the folder, together with its RAW and XMP files.
Needs a Mac with Apple Silicon and uv.
git clone https://github.com/birdingkit/osprey.git
cd osprey
uv syncThe first run downloads the detector and segmenter (about 800 MB).
uv run osprey ~/Pictures/2026-08-22[1/3] DSC06266.JPG 60.3 → B_soft/
[2/3] DSC07300.JPG 70.2 → A_sharp/
[3/3] DSC07714.JPG 64.1 → A_sharp/
3 photos in 1.8s: 2 A_sharp, 1 B_soft, 0 C_blurry, 0 D_no_animal
Subfolders are searched too, but everything lands in the four folders at the top. Photos already in those folders are left alone, so running again only sorts new photos. A photo whose name is already taken in its target folder is skipped.
| Folder | Animal sharpness (0–100) |
|---|---|
A_sharp |
61+ |
B_soft |
40–61 |
C_blurry |
under 40 |
D_no_animal |
no bird, dolphin or whale found |
The letter prefix keeps the folders in best-first order in Finder.
Files sharing the photo's name move with it: DSC0001.JPG, DSC0001.ARW and DSC0001.ARW.xmp stay together.
osprey moves files, it never deletes them. To undo, move the photos back out of the four folders.
OWL-ViT finds birds, dolphins and whales from text prompts, and SAM 2 outlines the largest one. Sharpness uses the re-blur metric of Crete et al. (2007) on the animal's pixels, so a soft background does not count against the photo.
A photo takes about 0.5 s on an M4 Mac.
- Only birds, dolphins and whales are looked for. Add more names to
ANIMALSinsrc/osprey/detect.py. - Very faint or distant animals, such as a pale seabird soaring against grey sky, can land in
D_no_animal. Check that folder before deleting anything. - The sharpness cut-offs were set on a handful of Sony A7 IV frames and may need adjusting for other cameras or subjects.