Skip to content

Commit cd90fd5

Browse files
authored
[Add] files via upload
1 parent df85474 commit cd90fd5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+7907
-2
lines changed

README.md

+81-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,81 @@
1-
# LaF-comparison-testing
2-
LaF focuses on the comparion testing of multiple deep learning models without manual labeling.
1+
# LaF: labeling-free comparison testing of deep learning models
2+
3+
## Problem definition
4+
5+
Given N pre-trained deep learning models, the task is to estimate the rank of models regrading their performance on an unlabeled test set.
6+
7+
## Dependency
8+
9+
- python 3.6.10
10+
- keras 2.6.0
11+
- tensorflow 2.5.1
12+
- scipy 1.5.4
13+
- numpy 1.19.5
14+
15+
## Download the dataset
16+
17+
###ID data###
18+
MNIST, CIFAR-10, and Fashion-MNIST are available in Keras.
19+
20+
Amazon and iwildcam are taken from [WILDS](https://github.com/p-lambda/wilds).
21+
22+
Java250 and C++1000 are taken from [Project CodeNet](https://github.com/IBM/Project_CodeNet).
23+
24+
###OOD data###
25+
26+
Download the OOD data of MNIST from [Google drive]() or generate it by <pre><code>python gene_mnist.py</code></pre>
27+
28+
Download the OOD data of CIFAR-10 from [Google drive]() or generate it by <pre><code>python gene_cifar10.py</code></pre>
29+
30+
Download the OOD data of Amazon and iwildCam from [WILDS](https://github.com/p-lambda/wilds).
31+
32+
Download the OOD data of Java250 from [Google drive]().
33+
34+
## Download Pre-trained deep learning models
35+
36+
Download all the models from [Google drive]().
37+
38+
You can also train the models for MNIST and CIFAR-10 by running the scripts in **trainModel/mnist** and **trainModel/cifar10**.
39+
40+
## How to use
41+
42+
To speed the execution and avoid calling the model repeatedly, we first get the model prediction. E.g.:
43+
44+
```
45+
python main_ground.py --dataName mnist
46+
```
47+
48+
To get the results by baseline methods (SDS, Random, CES), run the following code:
49+
50+
```
51+
python main_selection.py --dataName mnist --metric random
52+
```
53+
54+
Besides, to get the final results of CES, you need to run:
55+
56+
```
57+
python main_ces_best.py --dataName mnist
58+
```
59+
60+
To get the results by LaF, run the following code:
61+
```
62+
python main_laf.py --dataName mnist --dataType id
63+
```
64+
65+
To get the evaluation on kendall's tau, spearman's coefficients, jaccard similarity, run the following code:
66+
67+
```
68+
python main_eva.py --dataName mnist
69+
```
70+
71+
**[Notice] Be careful with the saving directories.**
72+
73+
## Reference
74+
<pre><code>@misc{guo2022labelingfree,
75+
title={Labeling-Free Comparison Testing of Deep Learning Models},
76+
author={Yuejun Guo and Qiang Hu and Maxime Cordy and Xiaofei Xie and Mike Papadakis and Yves Le Traon},
77+
year={2022},
78+
eprint={2204.03994},
79+
archivePrefix={arXiv},
80+
primaryClass={cs.LG}
81+
}</code></pre>

config.py

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import os
2+
3+
4+
class hyperparameters():
5+
def __init__(self, dataName, dataType="original", severity=0):
6+
self.dataName = dataName
7+
self.dataType = dataType
8+
self.severity = severity
9+
if dataName == "fashion":
10+
self.class_num = 10
11+
self.batch_size = 100
12+
self.model_num = 25
13+
elif dataName == "mnist":
14+
self.class_num = 10
15+
self.batch_size = 100
16+
self.model_num = 30
17+
elif "mnist-" in dataName:
18+
self.class_num = 10
19+
self.batch_size = 100
20+
self.model_num = 10
21+
elif dataName == "cifar10":
22+
self.class_num = 10
23+
self.batch_size = 100
24+
self.model_num = 30
25+
elif dataName == "java250":
26+
self.class_num = 250
27+
self.batch_size = 200
28+
self.model_num = 20
29+
elif dataName == "cpp1000":
30+
self.class_num = 1000
31+
self.batch_size = 512
32+
self.model_num = 20
33+
elif dataName == "iwildcamO":
34+
self.class_num = 182
35+
self.batch_size = 100
36+
self.model_num = 20
37+
elif dataName == "amazon":
38+
self.class_num = 5
39+
self.batch_size = 100
40+
self.model_num = 20
41+
42+
root_path = "/Volumes/1T/dnnCompare/"
43+
self.save_model_root = root_path + "{0}/savedM/".format(dataName)
44+
self.save_model_pre_root = root_path + "{0}/savedP/{1}/".format(dataName, dataType)
45+
self.save_log_root_test = root_path + "{0}/savedL/{1}/".format(dataName, dataType)
46+
self.save_result_root = root_path + "{0}/savedR/{1}/".format(dataName, dataType)
47+
self.save_ground_root = root_path + "{0}/savedG/{1}/".format(dataName, dataType)
48+
self.save_data_root_adv = root_path + "{0}/savedD/".format(dataName)
49+
if not os.path.isdir(self.save_model_root):
50+
os.makedirs(self.save_model_root)
51+
if not os.path.isdir(self.save_log_root_test):
52+
os.makedirs(self.save_log_root_test)
53+
if not os.path.isdir(self.save_data_root_adv):
54+
os.makedirs(self.save_data_root_adv)
55+
if not os.path.isdir(self.save_ground_root):
56+
os.makedirs(self.save_ground_root)
57+
if not os.path.isdir(self.save_result_root):
58+
os.makedirs(self.save_result_root)
59+
if not os.path.isdir(self.save_model_pre_root):
60+
os.makedirs(self.save_model_pre_root)

frosts/frost1.png

1.14 MB
Loading

frosts/frost2.png

292 KB
Loading

frosts/frost3.png

292 KB
Loading

frosts/frost4.jpg

35.9 KB
Loading

frosts/frost5.jpg

152 KB
Loading

frosts/frost6.jpg

88.1 KB
Loading

0 commit comments

Comments
 (0)