A lite image segmentation model to calculate volume of char in a container
Varaha is a leading global climate tech startup that specializes in nature-based solutions, including regenerative agriculture, agroforestry, and biochar projects that promote climate adaptation, biodiversity, water conservation and increased income for smallholder land stewards. Their project involved pyrolysis of wild invasisve plants to produce biochar. Snce this pyrolysis is carried in special large containers quantifying the volume of char produced was difficult using only manual labour. So an automation tool was need to carry this quantification.
We developed a Computer Vision model based on this model for our segmentation task. We added an attetion layer on top of the existing model for a better segmentation. Next after the container and biochar is detected we calculate the volume in two different ways using simple geometry and ANN.
I published a paper in Computational Materials Science, where we developed a smaller model to detect microstructure types. We used this model as encoder and designed an exact inverse of encoder for the decoder making both of them mirror image of each other. We also introduced a Attention Layer in the last block of encoder and vis-a-vis the first block of decoder to capture a wider context of features. The output is a 2 channel mask for biochar and the container in context. The segmentation model still works even when there is a pixel blockage by the biochar or manual intervention as we are using Attention that captures a wider context of features.
We have two ways of calculating volume.
- Geomentry. We consider the container to be a truncated cone and calculate the volume by finding the major and minor axes length of the open and close sides. Then we calculate percentage of the container that is filled up by char by checking the point where the biochar contour intersects the major axis of the open side of the conatiner.
- ANN Calculation of volume using geometry is deterministic way and shouldnt raise a problem in ideal world. But often we observe that container is disfigured or the char is filled very much or less in and around the major axis of the ellipse, ie the open face of the container. So we develop a shallow neural network to predict the volume of char from the latent that is generated by the encoder of the segmentation model.
I am thankful to Shaurya Sharma for his belief in me and providing me an oppurtunity to work on this interesting use-case.



