## 2 Materials and Methods
### Convolutional Neural Network:
#### Edge detection:  
We first want to detect the edges of the cells in the bright field images. For this purpose, we employ two well-known methods, namely, contrast limited adaptive histogram equalization (CLAHE) and Canny edge detection, one after the other. The CLAHE method partitions an image into small  
Figure 6: Architecture of the convolutional neural network used for perceiving the individual beads in clusters.  
Figure 7: Processed bright field images with beads hidden: (**a**) \(I_{jbh}^{in}(x,y)\); (**b**) \(I_{jbh}^{in}(x,y)\); (**c**) \(I_{jbh}^{in}(x,y)\).  
regions called tiles, where each tile's contrast is enhanced using a combination of adaptive histogram equalization and a clipping algorithm [45]. The neighboring tiles are then merged using bilinear interpolation. Canny edge detector is a multi-step algorithm that detects a wide range of edges in images [46] by defining the edges as curved line segments comprising points of abrupt changes in image brightness. The processed binary image sets are denoted as \(I_{e}^{inv}(x,y)\), \(I_{e}^{su}(x,y)\) and \(I_{e}^{sm}(x,y)\), examples of which are shown in Figure 8. However, due to intensity variations in the interior regions and portions of the exterior regions of the cells, there are a large number of false detections. These false detections are handled by the subsequent steps of our perception method.  
**Dilation:**  
We now apply dilation on the binary images with detected edges. In this step, the foreground boundaries (i.e., the white pixels) are enlarged or dilated, where the amount of dilation depends on a user-specified kernel size and shape. The new processed images for our three data sets are denoted by \(I_{d}^{inv}(x,y)\), \(I_{d}^{su}(x,y)\) and \(I_{d}^{sm}(x,y)\), respectively, where the cells start to get filled up as seen in Figure 9. However, the number of white pixels in the cells exterior regions increase significantly even though a major portion of the cells' interior regions turn white. Moreover, a small number of black pixels are still observed in the interior regions, which hinders accurate cell contour detection and needs to be taken care of.  
**Floodfill algorithm:**  
We now address the issue of detecting the disconnected black pixels in the cells interior regions. To do so, we first use the well-known floodfill algorithm. This algorithm requires two inputs, namely, a set of seed points and a replacement color. The pixels that are connected to the first seed point and have the same color as the seed point are filled by the replacement color, and this process is repeated for all the seed points one by one. We provide the image boundaries as the seed points and use white as the replacement color. Thus, this algorithm converts all the black pixels connected to the image boundaries to white. After employing this step on the dilated images, we obtain new binary images that are denoted by \(I_{f}^{ip}(x,y)\), \(I_{f}^{ip}(x,y)\) and \(I_{f}^{sm}(x,y)\), respectively, examples of which are shown in Figure 10. We then use the bitwise NOT operation to convert all the white pixels to black and vice versa. This process is applied to the floodfilled images, and the resultant images, \(I_{fd}^{ip}(x,y)\), \(I_{fd}^{sm}(x,y)\) and \(I_{fd}^{sm}(x,y)\), are added to the respective dilated images. The net effect of these operations is illustrated in Figure 11, which removes the previously detected black pixels in the cells' interior regions.