Skip to content

Commit be9c2da

Browse files
Add config section and update logo
1 parent bef0d6c commit be9c2da

File tree

16 files changed

+521
-114
lines changed

16 files changed

+521
-114
lines changed

book/augmentations/mixup.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ <h3 id="example"><a class="header" href="#example">Example</a></h3>
182182
<i class="fa fa-angle-left"></i>
183183
</a>
184184

185+
<a rel="next prefetch" href="../models/overview.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
186+
<i class="fa fa-angle-right"></i>
187+
</a>
185188

186189
<div style="clear: both"></div>
187190
</nav>
@@ -193,6 +196,9 @@ <h3 id="example"><a class="header" href="#example">Example</a></h3>
193196
<i class="fa fa-angle-left"></i>
194197
</a>
195198

199+
<a rel="next prefetch" href="../models/overview.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
200+
<i class="fa fa-angle-right"></i>
201+
</a>
196202
</nav>
197203

198204
</div>

book/augmentations/overview.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ <h1 id="augmentations"><a class="header" href="#augmentations">Augmentations</a>
188188

189189
<nav class="nav-wrapper" aria-label="Page navigation">
190190
<!-- Mobile navigation buttons -->
191-
<a rel="prev" href="../datasets/overview.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
191+
<a rel="prev" href="../metrics/general.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
192192
<i class="fa fa-angle-left"></i>
193193
</a>
194194

@@ -202,7 +202,7 @@ <h1 id="augmentations"><a class="header" href="#augmentations">Augmentations</a>
202202
</div>
203203

204204
<nav class="nav-wide-wrapper" aria-label="Page navigation">
205-
<a rel="prev" href="../datasets/overview.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
205+
<a rel="prev" href="../metrics/general.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
206206
<i class="fa fa-angle-left"></i>
207207
</a>
208208

book/config/overview.html

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
<!DOCTYPE HTML>
2+
<html lang="en" class="light sidebar-visible" dir="ltr">
3+
<head>
4+
<!-- Book generated using mdBook -->
5+
<meta charset="UTF-8">
6+
<title>Config - DD-Ranking API Documentation</title>
7+
8+
9+
<!-- Custom HTML head -->
10+
11+
<meta name="description" content="">
12+
<meta name="viewport" content="width=device-width, initial-scale=1">
13+
<meta name="theme-color" content="#ffffff">
14+
15+
<link rel="icon" href="../favicon.svg">
16+
<link rel="shortcut icon" href="../favicon.png">
17+
<link rel="stylesheet" href="../css/variables.css">
18+
<link rel="stylesheet" href="../css/general.css">
19+
<link rel="stylesheet" href="../css/chrome.css">
20+
<link rel="stylesheet" href="../css/print.css" media="print">
21+
22+
<!-- Fonts -->
23+
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
24+
<link rel="stylesheet" href="../fonts/fonts.css">
25+
26+
<!-- Highlight.js Stylesheets -->
27+
<link rel="stylesheet" href="../highlight.css">
28+
<link rel="stylesheet" href="../tomorrow-night.css">
29+
<link rel="stylesheet" href="../ayu-highlight.css">
30+
31+
<!-- Custom theme stylesheets -->
32+
<link rel="stylesheet" href="../theme/book.css">
33+
34+
<!-- MathJax -->
35+
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
36+
37+
<!-- Provide site root to javascript -->
38+
<script>
39+
var path_to_root = "../";
40+
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
41+
</script>
42+
<!-- Start loading toc.js asap -->
43+
<script src="../toc.js"></script>
44+
</head>
45+
<body>
46+
<div id="body-container">
47+
<!-- Work around some values being stored in localStorage wrapped in quotes -->
48+
<script>
49+
try {
50+
var theme = localStorage.getItem('mdbook-theme');
51+
var sidebar = localStorage.getItem('mdbook-sidebar');
52+
53+
if (theme.startsWith('"') && theme.endsWith('"')) {
54+
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
55+
}
56+
57+
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
58+
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
59+
}
60+
} catch (e) { }
61+
</script>
62+
63+
<!-- Set the theme before any content is loaded, prevents flash -->
64+
<script>
65+
var theme;
66+
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
67+
if (theme === null || theme === undefined) { theme = default_theme; }
68+
const html = document.documentElement;
69+
html.classList.remove('light')
70+
html.classList.add(theme);
71+
html.classList.add("js");
72+
</script>
73+
74+
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
75+
76+
<!-- Hide / unhide sidebar before it is displayed -->
77+
<script>
78+
var sidebar = null;
79+
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
80+
if (document.body.clientWidth >= 1080) {
81+
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
82+
sidebar = sidebar || 'visible';
83+
} else {
84+
sidebar = 'hidden';
85+
}
86+
sidebar_toggle.checked = sidebar === 'visible';
87+
html.classList.remove('sidebar-visible');
88+
html.classList.add("sidebar-" + sidebar);
89+
</script>
90+
91+
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
92+
<!-- populated by js -->
93+
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
94+
<noscript>
95+
<iframe class="sidebar-iframe-outer" src="../toc.html"></iframe>
96+
</noscript>
97+
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
98+
<div class="sidebar-resize-indicator"></div>
99+
</div>
100+
</nav>
101+
102+
<div id="page-wrapper" class="page-wrapper">
103+
104+
<div class="page">
105+
<div id="menu-bar-hover-placeholder"></div>
106+
<div id="menu-bar" class="menu-bar sticky">
107+
<div class="left-buttons">
108+
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
109+
<i class="fa fa-bars"></i>
110+
</label>
111+
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
112+
<i class="fa fa-paint-brush"></i>
113+
</button>
114+
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
115+
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
116+
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
117+
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
118+
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119+
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120+
</ul>
121+
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
122+
<i class="fa fa-search"></i>
123+
</button>
124+
</div>
125+
126+
<h1 class="menu-title">DD-Ranking API Documentation</h1>
127+
128+
<div class="right-buttons">
129+
<a href="../print.html" title="Print this book" aria-label="Print this book">
130+
<i id="print-button" class="fa fa-print"></i>
131+
</a>
132+
133+
</div>
134+
</div>
135+
136+
<div id="search-wrapper" class="hidden">
137+
<form id="searchbar-outer" class="searchbar-outer">
138+
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
139+
</form>
140+
<div id="searchresults-outer" class="searchresults-outer hidden">
141+
<div id="searchresults-header" class="searchresults-header"></div>
142+
<ul id="searchresults">
143+
</ul>
144+
</div>
145+
</div>
146+
147+
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
148+
<script>
149+
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
150+
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
151+
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
152+
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
153+
});
154+
</script>
155+
156+
<div id="content" class="content">
157+
<main>
158+
<h1 id="config"><a class="header" href="#config">Config</a></h1>
159+
<p>To ease the usage of DD-Ranking, we allow users to specify the parameters of the evaluator in a config file. The config file is a YAML file that contains the parameters of the evaluator. We illustrate the config file with the following example.</p>
160+
<pre><code class="language-yaml">dataset: CIFAR100 # dataset name
161+
real_data_path: ./dataset/ # path to the real dataset
162+
ipc: 10 # image per class
163+
im_size: [32, 32] # image size
164+
model_name: ResNet-18-BN # model name
165+
stu_use_torchvision: true # whether to use torchvision to load student model
166+
167+
tea_use_torchvision: true # whether to use torchvision to load teacher model
168+
169+
teacher_dir: ./teacher_models # path to the pretrained teacher model
170+
171+
data_aug_func: mixup # data augmentation function
172+
aug_params:
173+
lambda: 0.8 # data augmentation parameter; please follow this format for other parameters
174+
175+
use_zca: false # whether to use ZCA whitening
176+
177+
custom_train_trans: # custom torchvision-based transformations to process training data; please follow this format for your own transformations
178+
- name: RandomCrop
179+
args:
180+
size: 32
181+
padding: 4
182+
- name: RandomHorizontalFlip
183+
args:
184+
p: 0.5
185+
- name: ToTensor
186+
- name: Normalize
187+
args:
188+
mean: [0.4914, 0.4822, 0.4465]
189+
std: [0.2023, 0.1994, 0.2010]
190+
191+
custom_val_trans: null # custom torchvision-based transformations to process validation data; please follow the format above for your own transformations
192+
193+
use_aug_for_hard: false # whether to use data augmentation for hard label evaluation
194+
195+
soft_label_mode: M # soft label mode
196+
soft_label_criterion: kl # soft label criterion
197+
temperature: 30.0 # temperature for soft label
198+
optimizer: adamw # optimizer
199+
lr_scheduler: cosine # learning rate scheduler
200+
weight_decay: 0.01 # weight decay
201+
num_eval: 5 # number of evaluations
202+
num_epochs: 400 # number of training epochs
203+
default_lr: 0.001 # default learning rate
204+
num_workers: 4 # number of workers
205+
device: cuda # device
206+
syn_batch_size: 256 # batch size for synthetic data
207+
real_batch_size: 256 # batch size for real data
208+
save_path: ./results.csv # path to save the results
209+
</code></pre>
210+
<p>To use config file, you can follow the example below.</p>
211+
<pre><code class="language-python">from dd_ranking.metrics import SoftLabelEvaluator
212+
213+
config = Config(config_path='./config.yaml')
214+
evaluator = SoftLabelEvaluator(config)
215+
</code></pre>
216+
217+
</main>
218+
219+
<nav class="nav-wrapper" aria-label="Page navigation">
220+
<!-- Mobile navigation buttons -->
221+
<a rel="prev" href="../datasets/overview.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
222+
<i class="fa fa-angle-left"></i>
223+
</a>
224+
225+
226+
<div style="clear: both"></div>
227+
</nav>
228+
</div>
229+
</div>
230+
231+
<nav class="nav-wide-wrapper" aria-label="Page navigation">
232+
<a rel="prev" href="../datasets/overview.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
233+
<i class="fa fa-angle-left"></i>
234+
</a>
235+
236+
</nav>
237+
238+
</div>
239+
240+
<!-- Livereload script (if served using the cli tool) -->
241+
<script>
242+
const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
243+
const wsAddress = wsProtocol + "//" + location.host + "/" + "__livereload";
244+
const socket = new WebSocket(wsAddress);
245+
socket.onmessage = function (event) {
246+
if (event.data === "reload") {
247+
socket.close();
248+
location.reload();
249+
}
250+
};
251+
252+
window.onbeforeunload = function() {
253+
socket.close();
254+
}
255+
</script>
256+
257+
258+
259+
<script>
260+
window.playground_copyable = true;
261+
</script>
262+
263+
264+
<script src="../elasticlunr.min.js"></script>
265+
<script src="../mark.min.js"></script>
266+
<script src="../searcher.js"></script>
267+
268+
<script src="../clipboard.min.js"></script>
269+
<script src="../highlight.js"></script>
270+
<script src="../book.js"></script>
271+
272+
<!-- Custom JS scripts -->
273+
274+
275+
</div>
276+
</body>
277+
</html>

book/datasets/overview.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ <h3 id="parameters"><a class="header" href="#parameters">Parameters</a></h3>
209209
<i class="fa fa-angle-left"></i>
210210
</a>
211211

212-
<a rel="next prefetch" href="../augmentations/overview.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
212+
<a rel="next prefetch" href="../config/overview.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
213213
<i class="fa fa-angle-right"></i>
214214
</a>
215215

@@ -223,7 +223,7 @@ <h3 id="parameters"><a class="header" href="#parameters">Parameters</a></h3>
223223
<i class="fa fa-angle-left"></i>
224224
</a>
225225

226-
<a rel="next prefetch" href="../augmentations/overview.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
226+
<a rel="next prefetch" href="../config/overview.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
227227
<i class="fa fa-angle-right"></i>
228228
</a>
229229
</nav>

book/metrics/general.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ <h3 id="examples"><a class="header" href="#examples">Examples</a></h3>
260260
<i class="fa fa-angle-left"></i>
261261
</a>
262262

263-
<a rel="next prefetch" href="../models/overview.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
263+
<a rel="next prefetch" href="../augmentations/overview.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
264264
<i class="fa fa-angle-right"></i>
265265
</a>
266266

@@ -274,7 +274,7 @@ <h3 id="examples"><a class="header" href="#examples">Examples</a></h3>
274274
<i class="fa fa-angle-left"></i>
275275
</a>
276276

277-
<a rel="next prefetch" href="../models/overview.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
277+
<a rel="next prefetch" href="../augmentations/overview.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
278278
<i class="fa fa-angle-right"></i>
279279
</a>
280280
</nav>

book/models/overview.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ <h2 id="pretrained-model-weights"><a class="header" href="#pretrained-model-weig
186186

187187
<nav class="nav-wrapper" aria-label="Page navigation">
188188
<!-- Mobile navigation buttons -->
189-
<a rel="prev" href="../metrics/general.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
189+
<a rel="prev" href="../augmentations/mixup.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
190190
<i class="fa fa-angle-left"></i>
191191
</a>
192192

@@ -200,7 +200,7 @@ <h2 id="pretrained-model-weights"><a class="header" href="#pretrained-model-weig
200200
</div>
201201

202202
<nav class="nav-wide-wrapper" aria-label="Page navigation">
203-
<a rel="prev" href="../metrics/general.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
203+
<a rel="prev" href="../augmentations/mixup.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
204204
<i class="fa fa-angle-left"></i>
205205
</a>
206206

0 commit comments

Comments
 (0)