DiSSCo / SDR

Specimen Data Refinery
Apache License 2.0
6 stars 0 forks source link

Create a Galaxy tool for image segmentation #44

Closed PaulBrack closed 2 years ago

PaulBrack commented 2 years ago

Segmentation tool provided by Teklia as a self-contained Dockerised image which does not make any external service calls.

llivermore commented 2 years ago

Works as expected. Tested on a few specimens including NHMUK012824346. Example output (reference image below):

{
    "authoritative": {
        "physicalSpecimenId": "test",
        "institution": [
            "test",
            "test"
        ],
        "materialType": "Pinned insect"
    },
    "images": {
        "availableImages": [
            {
                "source": "https://data.nhm.ac.uk/media/659121/preview",
                "license": "CC BY"
            }
        ]
    },
    "higher_classification": "test",
    "payloads": {
        "name": "original image",
        "filename": "55655020-e676-471d-b848-97794134f9c6.jpeg",
        "width": 1440,
        "height": 960,
        "mediaType": "image/jpeg",
        "size n": 196911
    },
    "regions": [
        {
            "polygon": [
                [
                    1040,
                    67
                ],
                [
                    1350,
                    61
                ],
                [
                    1353,
                    223
                ],
                [
                    1044,
                    228
                ]
            ],
            "confidence": 0.94,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    63,
                    97
                ],
                [
                    843,
                    82
                ],
                [
                    853,
                    611
                ],
                [
                    73,
                    626
                ]
            ],
            "confidence": 0.84,
            "class_name": "specimen"
        },
        {
            "polygon": [
                [
                    1053,
                    249
                ],
                [
                    1350,
                    249
                ],
                [
                    1350,
                    390
                ],
                [
                    1053,
                    390
                ]
            ],
            "confidence": 0.92,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    1374,
                    406
                ],
                [
                    1408,
                    406
                ],
                [
                    1408,
                    421
                ],
                [
                    1374,
                    421
                ]
            ],
            "confidence": 0.45,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    1320,
                    408
                ],
                [
                    1363,
                    408
                ],
                [
                    1363,
                    420
                ],
                [
                    1320,
                    420
                ]
            ],
            "confidence": 0.48,
            "class_name": "color_bar"
        },
        {
            "polygon": [
                [
                    1230,
                    414
                ],
                [
                    1318,
                    408
                ],
                [
                    1320,
                    420
                ],
                [
                    1231,
                    425
                ]
            ],
            "confidence": 0.55,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    1055,
                    421
                ],
                [
                    1138,
                    418
                ],
                [
                    1140,
                    425
                ],
                [
                    1057,
                    429
                ]
            ],
            "confidence": 0.45,
            "class_name": "color_bar"
        },
        {
            "polygon": [
                [
                    997,
                    425
                ],
                [
                    1406,
                    405
                ],
                [
                    1413,
                    573
                ],
                [
                    1006,
                    592
                ]
            ],
            "confidence": 0.73,
            "class_name": "bar_code"
        },
        {
            "polygon": [
                [
                    873,
                    534
                ],
                [
                    907,
                    525
                ],
                [
                    911,
                    538
                ],
                [
                    877,
                    547
                ]
            ],
            "confidence": 0.46,
            "class_name": "specimen"
        },
        {
            "polygon": [
                [
                    1005,
                    562
                ],
                [
                    1413,
                    549
                ],
                [
                    1415,
                    618
                ],
                [
                    1008,
                    631
                ]
            ],
            "confidence": 0.65,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    1001,
                    601
                ],
                [
                    1005,
                    583
                ],
                [
                    1021,
                    586
                ],
                [
                    1018,
                    605
                ]
            ],
            "confidence": 0.43,
            "class_name": "color_bar"
        },
        {
            "polygon": [
                [
                    963,
                    665
                ],
                [
                    1083,
                    665
                ],
                [
                    1083,
                    675
                ],
                [
                    963,
                    675
                ]
            ],
            "confidence": 0.46,
            "class_name": "color_bar"
        },
        {
            "polygon": [
                [
                    1078,
                    667
                ],
                [
                    1408,
                    667
                ],
                [
                    1408,
                    761
                ],
                [
                    1078,
                    761
                ]
            ],
            "confidence": 0.51,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    1365,
                    667
                ],
                [
                    1368,
                    656
                ],
                [
                    1410,
                    667
                ],
                [
                    1408,
                    680
                ]
            ],
            "confidence": 0.23,
            "class_name": "color_bar"
        },
        {
            "polygon": [
                [
                    3,
                    669
                ],
                [
                    991,
                    663
                ],
                [
                    993,
                    913
                ],
                [
                    5,
                    918
                ]
            ],
            "confidence": 0.73,
            "class_name": "scale_bar"
        },
        {
            "polygon": [
                [
                    946,
                    695
                ],
                [
                    978,
                    690
                ],
                [
                    1003,
                    841
                ],
                [
                    971,
                    847
                ]
            ],
            "confidence": 0.26,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    988,
                    838
                ],
                [
                    1016,
                    834
                ],
                [
                    1021,
                    877
                ],
                [
                    993,
                    879
                ]
            ],
            "confidence": 0.43,
            "class_name": "color_bar"
        },
        {
            "polygon": [
                [
                    950,
                    871
                ],
                [
                    963,
                    665
                ],
                [
                    1415,
                    693
                ],
                [
                    1402,
                    900
                ]
            ],
            "confidence": 0.49,
            "class_name": "bar_code"
        },
        {
            "polygon": [
                [
                    1155,
                    900
                ],
                [
                    1168,
                    856
                ],
                [
                    1280,
                    886
                ],
                [
                    1269,
                    930
                ]
            ],
            "confidence": 0.49,
            "class_name": "label"
        },
        {
            "polygon": [
                [
                    945,
                    901
                ],
                [
                    969,
                    838
                ],
                [
                    1076,
                    879
                ],
                [
                    1050,
                    943
                ]
            ],
            "confidence": 0.43,
            "class_name": "label"
        }
    ]
}

preview

llivermore commented 2 years ago

Currently only has a model for pinned insects and not herbarium sheets or microscope slides.