The profit share of the vegetable market, which is quite large in the agricultural industry, needs to be equipped with the ability to classify types of vegetables quickly and accurately. Some vegetables have a similar shape, such as onions and garlic, which can lead to misidentification of these types of vegetables. Through the use of computer vision and machine learning, vegetables, especially onions, can be classified based on the characteristics of shape, size, and color. In classifying shallot and garlic images, the CNN model was developed using 4 convolutional layers, with each layer having a kernel matrix of 2x2 and a total of 914,242 train parameters. The activation function on the convolutional layer uses ReLu and the activation function on the output layer is softmax. Model accuracy on training data is 0.9833 with a loss value of 0.762.