Free Insect Images

0 views
Skip to first unread message

Alix Stocking

unread,
Aug 3, 2024, 5:14:53 PM8/3/24
to paylayconsanf

Is there anything I can do in this case (flag them or mark them as casual etc), or have I understood the premise of the iNaturalist-platform wrong? Now that one spot on the map is getting a ridiculous amount of observations of a ridiculous amount of insect species. It really bugs (pun intended) me.

This collection of more than 500,000 specimens represents the rich insect diversity of the Appalachian region and is an exceptional repository of endangered insects, pollinators, and many native species once common but now disappearing from habitat loss, like the rusty patched bumble bee collected in 1863. This native pollinator was once widespread through the eastern United States but the native meadows and forests that were their homes are vanishing and their population has dwindled. They are now on the U.S. Fish and Wildlife endangered species list.

Thanks to a 2019 Digitizing Hidden Special Collections and Archives award from the Council on Library and Information Resources (CLIR) funded by The Andrew W. Mellon Foundation, Hall and Marek will be embarking on a two-year project to preserve 15,000 specimens through two-dimensional digitization. They will also create three-dimensional digital models of 300 more using photogrammetry.

The digital collection will include the digitized physical picture or 3D model of the insect and metadata including measurements, chemical compositions, ancient DNA information, and other biological or geographical information. This gives anyone with an Internet connection an opportunity to learn from the past and build on future policies and discoveries.

Once the collection is digitized, the general public can access it through the University Libraries at Virginia Tech and the Digital Library of America. More researcher-focused access will be through iDigBio and Symbiota Collection of Arthropods Network (SCAN).

Hello from the world of entomology! I am a little desperate to find a solution to my issue for accurately counting eggs from the springtail Folsomia candida. I feel I have gone very deep into a rabbit hole and am at a loss to try and find a decent solution for my problem. I also think that given my relative inexperience in this type of computer vision problem I may have gone down an overcomplicated road and could certainly do with some help from this community.

The eggs in these images are in the larger range of your typical objects posted here and need to be identified and counted (imaged on dissection microscope on black filter paper, background cropped out). I have tried so many things including training a DenoiSeg model to clean up the background and get better segmentation from the noisy background (see pictures attached of denoised image and binary) but the tricky thing is that they cluster together and are sometimes overlapping/occluded. Whilst my DenoiSeg model seems to do quite well at segmenting the eggs from the background (binary image) I still run into the issue of trying to count eggs that are clustered together.

I would really appreciate any tips or directions here. I understand that these are relatively very noisy images when compared to high res microscopy but I dont think this can be practically avoided without making the process of isolating eggs too cumbersome/time consuming (high throughput experiment). A common issue with many biological assays on egg output is that organisms like this species are very very fecund and produce large numbers of eggs so figuring out some sort of system for counting eggs would be amazing (I have thousands of images).

Your images look like they might be too low resolution, if that is the max, but if you upsample them a little bit you might be able to do something like How to count bees (pattern recognition and segmentation)

Thanks @Research_Associate I really appreciate your suggestion, unfortunately that is the max resolution for this old Leica! Do you have any preference on what software to use for pattern recognition & segmentation?

Wow thats impressively simple and elegant, thank you for the fantastic suggestion. Apologies for the elementary questions, I have not used template matching before and am still becoming familiar with python syntax! Can you tell me how exactly you get the coordinates for the template = im[333:341, 456:464] line of code? Can you get these from napari viewer?
I assume this would mean I would need to isolate a single egg in each image I need to analyse (thousands) or is it possible to use a template from one image (all same size) to match across individual images?

Amazing got this to work quite nicely for several different images, could be refined but it works mostly well. Thank you again! If you have any suggestions on how i might refine this I am certainly all ears!

An alternative is to use plain segmentation to capture the eggs. I tried your image with cellpose, played a bit with parameters (cell diameter is important!) and obtained an over segmentation capturing the great majority of eggs. False positives can then be eliminated post segmentation by removing those segmented regions with low median, or mean, intensity. For very few clusters cells were lumped together. @Jermaine_Guiterrez is right on, catching all eggs might be difficult due to reduced spatial resolution.

Thank you Alex, hugely appreciate your suggestions. I have not tried Cellpose this looks really quite good. I agree with you both, higher spatial resolution would have been ideal. I thought diameter would be important, they are pretty uniform in size. I will definitely give your strategy a go as well and compare how to performs with my current template matching strategy. I think I will need to just do a semi-automatic approach to counting these eggs (check for false negatives and positives and amend counts after running automatic counter). Since it generally does quite well this will still save me a lot of time!

If you are looking to call cellpose from Python to facilitate quick comparisons with other Python approaches you can do it in a couple lines of code. The below code calls Cellpose with similar settings to what @alscunha used.

In the end cellpose seems to be working really great. Due to the low resolution of my images its far from perfect so I will probably still go through and count false positives/negatives in each image, unless a random/representative sample of images shows the accuracy to generally be high enough.

I have created a batch processing script in python to iterate through a folder of images and save the overlays of masks identified from the cellpose model onto the original images (so I can eyeball em) and also save filenames along with counts and other information pulled from filenames (in this case things like isoline, date, ID etc) into a csv file.
Would it be useful for me to post this script here for other community members?

If images across the set have similar statistics you may save yourself some work by retraining the model so it learns from the mistakes. If you are manually going through your images anyway it might be worth it to relabel some. For the bee problem I trained using python and stardist.

Wow, Brian thank you so much for all of this effort/ suggestion and great video! I will try and have a go at some label corrections on a few images (maybe 10 or so) and retraining a cellpose model. Hopefully I can get this to work well following your notebooks/video

Hi folks, here is a link to my batch processing file to implement a pretrained cellpose model and get egg counts as well as extract information from image file names to save to a csv file. The script saves all overlayed masks on original images as well as separate label images into output folders.
My image file names contain information for example: I1_F1_O20_SWI_R1_13-09-23 where I1 = isoline, F1 = generation, O = age, could be Y, 20 = temperature (could be 25 degrees), SWI = treatment (could be CON), and R1 = replicate. The script collects this data and adds to the output csv so I have a complete data set with relevant information for further analyses.
I hope this may be useful for someone else attempting to apply these methods on mass!
I am currently training my own custom cellpose model (refining and correcting erroneous labels based on the pretrained cyto2 model) and will amend a version of this script to use that model for improved accuracy.

I believe your conclusion @Zac_Wylde is right, re-training in this case might not help much, the signal in the lumped cells is pretty similar to the others so there is no significant differences to be learned. Keep in mind that the gradient of the signal is also what is learned. The gradient on your lumped cells is probably already in cyto2 and not strong enough to separate small touching cells for a given diameter. If you decrease the diameter, say to 5, you might be able to split some clumps but at the price of missing other larger cells and introducing more false positives, as any small feature is now accepted as a solution, see example in figure below. There is no free lunch!

An intrinsic limitation of cellpose formulation is handling a large variation of object/cell sizes in the same image. The method works by scaling your image such that the diameter you provide is normalized to a target value of 30. You can see that when one provides a large diameter, say 120, scaling down the image will make disappear small cells which will not be present in the final segmentation. This is a compromise not an unexpected property of the method.

To use these images for commercial purposes, prior approval by individual photographers must be obtained. Images without photographer information are property of the Penn State Department of Entomology. For more information, call 814-865-1896 or e-mail entom...@psu.edu.

I noticed a small raisin lying on the kitchen worktop this morning. I tried to pick it up for disposal -- and it started to walk away! It turned out to be a red-spotted black ladybird. I put it on the garden flowers, where it can make itself useful.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages