|
1 | 1 | # ood-detection-benchmarks
|
2 | 2 |
|
3 |
| -Evaluation of algorithms to detect out-of-distribution data |
| 3 | +Out-of-distribution (OOD) detection is the task of determining whether a datapoint comes from a different distribution than the training dataset. For example, we may train a model to classify the breed of dogs and find that there is a cat image in our dataset. This cat image would be considered out-of-distribution. |
| 4 | + |
| 5 | +OOD detection is useful to find label issues where the actual ground truth label is not in the set of labels for our task (e.g. cat label for a dog breed classification task). This can serve many use-cases, some of which include: |
| 6 | + |
| 7 | +- Remove OOD datapoints from our dataset as part of a data cleaning pipeline |
| 8 | +- Consider adding new classes to our task |
| 9 | +- Gain deeper insight into the data distribution |
| 10 | + |
| 11 | +This work evaluates the effectiveness of various scores to detect OOD datapoints. |
| 12 | + |
| 13 | +We also present a novel OOD score using the average entropy of K-nearest neighbors. |
| 14 | + |
| 15 | +## Methodology |
| 16 | + |
| 17 | +We treat OOD detection as a binary classification task (True or False: is the datapoint out-of-distribution?) and evaluate the performance of various OOD scores using AUROC. |
| 18 | + |
| 19 | +## Experiments |
| 20 | + |
| 21 | +For each experiment, we perform the following procedure: |
| 22 | + |
| 23 | +1. Train a Neural Network model with ONLY the **in-distribution** training dataset. |
| 24 | +2. Use this model to generate predicted probabilties and embeddings for the **in-distribution** and **out-of-distribution** test datasets (these are considered out-of-sample predictions). |
| 25 | +3. Use out-of-sample predictions to generate OOD scores |
| 26 | +4. Compute AUROC of OOD scores to detect OOD datapoints |
| 27 | + |
| 28 | +| Experiment ID | In-Distribution | Out-of-Distribution | |
| 29 | +| :------------ | :-------------- | :------------------ | |
| 30 | +| 0 | cifar-10 | cifar-100 | |
| 31 | +| 1 | cifar-100 | cifar-10 | |
| 32 | +| 2 | mnist | roman-numeral | |
| 33 | +| 3 | roman-numeral | mnist | |
| 34 | +| 4 | mnist | fashion-mnist | |
| 35 | +| 5 | fashion-mnist | mnist | |
| 36 | + |
| 37 | +## Instructions |
| 38 | + |
| 39 | +#### 0. Prerequisite |
| 40 | + |
| 41 | +- [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker): allows us to properly utilize our NVIDIA GPUs inside docker environments |
| 42 | + |
| 43 | +#### 1. Run docker-compose to build the docker image and run the container |
| 44 | + |
| 45 | +Clone this repo and run below commands: |
| 46 | + |
| 47 | +```bash |
| 48 | +sudo docker-compose build |
| 49 | +sudo docker-compose run --rm --service-port dcai |
| 50 | +``` |
| 51 | + |
| 52 | +#### 2. Start Jupyter Lab |
| 53 | + |
| 54 | +```bash |
| 55 | +make jupyter-lab |
| 56 | +``` |
| 57 | + |
| 58 | +#### 3. Train all models with a single notebook |
| 59 | + |
| 60 | +[src/experiments/OOD/0_Train_Models.ipynb]() |
| 61 | + |
| 62 | +#### 4. Run all experiments with a single notebook |
| 63 | + |
| 64 | +[src/experiments/OOD/1_Evaluate_All_OOD_Experiments.ipynb]() |
| 65 | + |
| 66 | +## Results |
| 67 | + |
| 68 | +Preparation of final results in progress |
0 commit comments