This repository is the 3rd place solution for DACON Anomaly Detection Algorithm contest. We developed an algorithm that can classify the type and state of objects by learning an imbalanced dataset. The key strategies used are as follows:
- We consider the type and state of an object as a pair of classes and perform class-wise augmentation.
- To solve problems caused by class imbalance, the model additionally learned about specific objects is used for hard voting to make the final prediction.
This is the overall model process.
MVTec's Anomaly Detection dataset consists of 15 object types and 49 object states, with a total of 88 labels.
- To reduce confusion between state within an object, different augmentation is applied to each object to learn the model. (class-wise augmentation)
- In addition to the main model, we additionally learn class-specific model for post-processing.
- To prevent overfitting due to class imbalance, change the state of the object to normal/anomaly and learn ① binary classification model. During inference ①, in the case of a sample classified as normal with low confidence, the predictions of main model is also adjusted to the second highest prediction when it is normal. (Based on F1 score, 0.8548 -> 0.8729)
- To resolve low confidence in specific objects, we learned class-specific model. ② toothbrush model and ③ zipper model were used as post-processing. (Based on F1 score, 0.8729 -> 0.9087)
-
Install Library
pip install -r requirements.txt pip install jupyter
-
Download data.zip from https://dacon.io/competitions/official/235870/data to data path.
#./workspace mkdir data cd data (Download data to ./workspace/data/) unzip data.zip unzip train.zip unzip test.zip
-
Prepare data : You can run this section in this ipynb
-
Training
sh multi_train.sh
-
Test : You can run this section in test.py
-
Inference & Post-processing : You can run this section in solution.ipynb