Maintaining normal operations, without defects or breaks, is the main objective for industrial companies. This is because any anomaly in this sense affects the entire production chain and can disrupt the internal functioning of a factory at various levels... To achieve this goal, control is required throughout the process so that intervention can be made as quickly as possible without slowing down the cycle time or increasing the price of the product. To free themselves from these complicated control processes, industrial companies are turning to the technology of artificial intelligence technology, more specifically machine learning, which is the key to Industry 4.0, to automate the control process. Hence the objective of this article. The objective of our research is to develop an algorithmic solution for the detection of anomalies and nonconformities in production units, through an automatic classification of the data collected by the sensors (which represent the INPUTS of our model) into two categories: defects and without defects, which constitute the set of arrivals of the value of OUTPUT. Establish a model of non-conformity detection in the industrial process (which is the first step in nonconformity management) by integrating Machine Learning to inspect defects in the industrial environment, such as product quality control, predictive maintenance of production equipment, or even monitoring compliance with measures and safety rules. To perform the production. This moderated approach consists in detecting the anomaly as soon as possible through a measurement of the standard deviation between the current state of the object and the ideal state via sensors to classify the result according to the classification criteria pre-established by the experts in our prediction machine. To illustrate this model of machine learning a case study from the automotive industry is presented, through a model that detects the defect of paint in car bodywork