# Mineral Identification Based on Deep Learning Using Image Luminance Equalization
## 2 The Proposed Method
### A New Algorithm Based on HELaplace  
In order to overcome the shortcomings of the aforementioned classical histogram and Laplace algorithms, and considering the characteristics of using image fusion, this paper proposes a new algorithm for image enhancement by HELaplace. In this paper, we combine the idea of image fusion by first processing the images with histogram equalization algorithm and Laplace operator, respectively, and then fusing the processed images into a new image after weighting the average by a certain proportion. This approach demonstrates a good enhancement effect within a certain percentage range. We convert the input image \(G\) into YCrCb (a kind of color coding method) [29] space, and then separate the YCrCb image channels and equalize the image histogram using the CLAHE [30] algorithm, which can improve the details of the image while avoiding the problem of the excessive contrast enhancement of the image. The processed channel and the unprocessed channel are combined and then converted to RGB image \(A\). The image is then sharpened and enhanced using the 8-neighborhood Laplace operator with center 5 and image convolution, and the enhanced image is noted as \(B\). The weighted average image fusion algorithm can be expressed as:  
\[F(i,j)=\lambda A(i,j)+(1-\lambda)B(i,j) \tag{3}\]  
where the input image \(A(i,j)\) represents the illumination function of the image after HE algorithm processing, \(B(i,j)\) represents the illumination function of the image after Laplace processing, and the output image \(F(i,j)\) represents the fused image. The size of the image is \(256\times 256\) pixels, \(i\) and \(j\) are the coordinates of a pixel in the image, and \(i,j\in[256,256]\), \(A,B\in[0,255]\). The algorithm description of HELaplace is shown in Algorithm 1. We apply the HELaplace algorithm to the same image and the result is shown in Figure 1. By comparison, we can see that the image is better after the HELaplace algorithm. ```
0: Original image G
0: Synthetic image G
1: YCrCb = COLOR_BGR2 YCR_CB(G)
2: // Converting RGB images to YCrCb space
3: channels = split(YCrCb)
4: // Separate YCrCb image channels
5: YCrCb = merge(channels)
6: // Convert YCrCb image back to RGB image
7:!! ## 3 Architecture of the Neural Network

### Description of Our Model

The main procedure of the experiment is shown in Figure 2. First, we collect data on a variety of minerals. Then, we label all the data and split the dataset into a training set and a test set. HELaplace processing is performed on the data from the test set and training set. Then, the obtained training set is used to train in a convolutional neural network through the YOLOv5 model. Finally, the classification to which each mineral picture in the test set belongs is calculated and the accuracy rate is recorded. Specifically, Figure 3 illustrates the specific structure of the YOLOv5 network. It consists of four parts: input, backbone, neck, and prediction. The input side uses Mosaic data enhancement [23] and adaptive anchor frame calculation. The backbone part uses the focus structure and the cross-stage-partial-connections (CSP) structure. The neck part uses a feature pyramid network (FPN) + pixel aggregation network (PAN)) structure. The prediction part uses non-maximal suppression (NMS) to filter the targets, so it has high accuracy. As a new type of deep neural network (DNN), unlike traditional algorithms that require strict image pixel size, YOLOv5's adaptive image scaling has no requirement in terms of image size. We also modified the YOLOv5 code in the letterbox function of datasets.py to add a minimum of black borders to the adaption of the original image, reducing information redundancy and therefore greatly improving the processing speed. The CSP structure of YOLOv5s is to divide the original input into two branches and perform separate convolution operations to halve the number of channels. One branch performs the Bottleneck * N operation, then concats two branches.