machine-shop / mothra

Automated butterfly wing length measurement
Other
27 stars 15 forks source link

Removing grabcut and classic segmentations #70

Closed alexdesiqueira closed 3 years ago

alexdesiqueira commented 3 years ago

In this PR, we remove ~classical~classic (Otsu threshold) and grabcut segmentation options, leaving only U-nets.

alexdesiqueira commented 3 years ago

Hey @stefanv,

Question: is there graceful fallback when the NN model file is not found?

It downloads the files automatically:

❯ ./pipeline.py -u
(...)
Image 1/1 : BMNHE_500607.JPG
models/segmentation.pkl not in the path. Downloading...
Downloading data from 'https://gitlab.com/mothra/mothra-data/-/raw/main/models/segmentation/segmentation.pkl' to file '/home/alex/projects/mothra/models/segmentation.pkl'.
(...)
Identifying gender...
models/id_gender.pkl not in the path. Downloading...
Downloading data from 'https://gitlab.com/mothra/mothra-data/-/raw/main/models/id_gender/id_gender.pkl' to file '/home/alex/projects/mothra/models/id_gender.pkl'.

You're right, though; I hard-coded where the files should be. I think it'd be nice to have the option to pass the weights, and only then offer to download them.

stefanv commented 3 years ago

I think that's fine for now.

alexdesiqueira commented 3 years ago

Thank you @stefanv!