Defect detection and classification on the final products are necessary for the manufacturers to ensure the quality of the final product before delivering it to the end customers. With rapid changes in manufacturing technologies, most of the companies have changed their operation methods toward industry 4.0. On this road, developing an automatic detection system based on the surface images can enhance the productivity and ensure the quality of the product. However, only a few studies have developed the models for solving this problem. Due to its complicated structure and parameters, designing an optimal convolution neural network (CNN) is still a challenge. Thus, this study aims to propose an autotuning genetic algorithm with two-dimension chromosomes for designing an optimal CNN model efficiently. In particular, a two-dimension chromosome is developed to represent a CNN’s structure and parameters. To enhance the searching process, the crossover rate and mutation rate are tuned automatically according to the generation. A two-dimension crossover method is proposed to create offspring for selecting the next population. In addition, a case of ceramic textile manufacturing is constructed to validate the proposed approach. The accuracy of the proposed approach is up to 95.5 percent on the testing dataset.