Skip to content

Commit eec666b

Browse files
authored
Minor Refactor (#83)
* Adding One Pixel Attack Core * Update test_one_pixel_attack.py * solve obj reference err * solve pytest err * solve merge * solve merge * minor refactor * solve circular dep issue
1 parent 0cff83b commit eec666b

31 files changed

+405
-62
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Chefs of the Code-Soup
1212
* [Abheesht Sharma](https://www.linkedin.com/in/abheesht-sharma-567303156/)
1313
* [Harshit Pandey](https://www.linkedin.com/in/harshit-pandey-a77302173/)
1414
* [Gunjan Chhablani](https://gchhablani.github.io/)
15+
* Mehul Rastogi
1516

1617

1718
Contributors

REPO_STRUCTURE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ Main package to be used in fencing and build attacks / defenses
2727
| +-- rl/ #Same as above
2828
# For every chapter ->
2929
+-- ch{Chapter_Number}/ #Code refering to a particular chapter
30-
| +-- utils/ #Utils Required for the chapter
31-
| +-- models/ #Attackers or Defenders used in the chapter
30+
| +-- algorithms/ #Attackers or Defenders used in the chapter
3231
| | +--{Name_of_Attack/Defense}.py
3332
# There will be exactly one file pertaining to the agents.
3433
# This is supposed to be parallel to the pseudcode in a book.
@@ -50,10 +49,11 @@ For Unit testing of each module in the package
5049
| | +-- test_dataset/
5150
| +-- test_text/
5251
| +-- test_rl/
52+
| +-- test_utils/
53+
5354
# For every chapter ->
5455
+-- test_ch{Chapter_Number}/
55-
| +-- test_utils/
56-
| +-- test_models/
56+
| +-- test_algorithms/
5757
| | +--test_{Name_of_Attack/Defense}.py
5858
```
5959

code_soup/ch5/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from code_soup.ch5.models import GAN
1+
from code_soup.ch5.algorithms.gan import GAN, Discriminator, Generator
2+
from code_soup.ch5.algorithms.one_pixel_attack import OnePixelAttack
3+
from code_soup.ch5.algorithms.zoo_attack import ZooAttack
File renamed without changes.

code_soup/ch5/models/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

code_soup/common/text/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# utils import
2+
from code_soup.common.text.utils import perturbations
3+
4+
# datasets
5+
6+
# models

code_soup/common/text/keys_in_proximity.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 334 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,334 @@
1+
{
2+
"a": [
3+
"q",
4+
"w",
5+
"s",
6+
"x",
7+
"z"
8+
],
9+
"b": [
10+
"v",
11+
"g",
12+
"h",
13+
"n"
14+
],
15+
"c": [
16+
"x",
17+
"d",
18+
"f",
19+
"v"
20+
],
21+
"d": [
22+
"s",
23+
"e",
24+
"r",
25+
"f",
26+
"c",
27+
"x"
28+
],
29+
"e": [
30+
"w",
31+
"s",
32+
"d",
33+
"r"
34+
],
35+
"f": [
36+
"d",
37+
"r",
38+
"t",
39+
"g",
40+
"v",
41+
"c"
42+
],
43+
"g": [
44+
"f",
45+
"t",
46+
"y",
47+
"h",
48+
"b",
49+
"v"
50+
],
51+
"h": [
52+
"g",
53+
"y",
54+
"u",
55+
"j",
56+
"n",
57+
"b"
58+
],
59+
"i": [
60+
"u",
61+
"j",
62+
"k",
63+
"o"
64+
],
65+
"j": [
66+
"h",
67+
"u",
68+
"i",
69+
"k",
70+
"n",
71+
"m"
72+
],
73+
"k": [
74+
"j",
75+
"i",
76+
"o",
77+
"l",
78+
"m"
79+
],
80+
"l": [
81+
"k",
82+
"o",
83+
"p"
84+
],
85+
"m": [
86+
"n",
87+
"j",
88+
"k",
89+
"l"
90+
],
91+
"n": [
92+
"b",
93+
"h",
94+
"j",
95+
"m"
96+
],
97+
"o": [
98+
"i",
99+
"k",
100+
"l",
101+
"p"
102+
],
103+
"p": [
104+
"o",
105+
"l"
106+
],
107+
"q": [
108+
"w",
109+
"a",
110+
"s"
111+
],
112+
"r": [
113+
"e",
114+
"d",
115+
"f",
116+
"t"
117+
],
118+
"s": [
119+
"w",
120+
"e",
121+
"d",
122+
"x",
123+
"z",
124+
"a"
125+
],
126+
"t": [
127+
"r",
128+
"f",
129+
"g",
130+
"y"
131+
],
132+
"u": [
133+
"y",
134+
"h",
135+
"j",
136+
"i"
137+
],
138+
"v": [
139+
"c",
140+
"f",
141+
"g",
142+
"v",
143+
"b"
144+
],
145+
"w": [
146+
"q",
147+
"a",
148+
"s",
149+
"e"
150+
],
151+
"x": [
152+
"z",
153+
"s",
154+
"d",
155+
"c"
156+
],
157+
"y": [
158+
"t",
159+
"g",
160+
"h",
161+
"u"
162+
],
163+
"z": [
164+
"a",
165+
"s",
166+
"x"
167+
],
168+
"A": [
169+
"Q",
170+
"W",
171+
"S",
172+
"X",
173+
"Z"
174+
],
175+
"B": [
176+
"V",
177+
"G",
178+
"H",
179+
"N"
180+
],
181+
"C": [
182+
"X",
183+
"D",
184+
"F",
185+
"V"
186+
],
187+
"D": [
188+
"S",
189+
"E",
190+
"R",
191+
"F",
192+
"C",
193+
"X"
194+
],
195+
"E": [
196+
"W",
197+
"S",
198+
"D",
199+
"R"
200+
],
201+
"F": [
202+
"D",
203+
"R",
204+
"T",
205+
"G",
206+
"V",
207+
"C"
208+
],
209+
"G": [
210+
"F",
211+
"T",
212+
"Y",
213+
"H",
214+
"B",
215+
"V"
216+
],
217+
"H": [
218+
"G",
219+
"Y",
220+
"U",
221+
"J",
222+
"N",
223+
"B"
224+
],
225+
"I": [
226+
"U",
227+
"J",
228+
"K",
229+
"O"
230+
],
231+
"J": [
232+
"H",
233+
"U",
234+
"I",
235+
"K",
236+
"N",
237+
"M"
238+
],
239+
"K": [
240+
"J",
241+
"I",
242+
"O",
243+
"L",
244+
"M"
245+
],
246+
"L": [
247+
"K",
248+
"O",
249+
"P"
250+
],
251+
"M": [
252+
"N",
253+
"J",
254+
"K",
255+
"L"
256+
],
257+
"N": [
258+
"B",
259+
"H",
260+
"J",
261+
"M"
262+
],
263+
"O": [
264+
"I",
265+
"K",
266+
"L",
267+
"P"
268+
],
269+
"P": [
270+
"O",
271+
"L"
272+
],
273+
"Q": [
274+
"W",
275+
"A",
276+
"S"
277+
],
278+
"R": [
279+
"E",
280+
"D",
281+
"F",
282+
"T"
283+
],
284+
"S": [
285+
"W",
286+
"E",
287+
"D",
288+
"X",
289+
"Z",
290+
"A"
291+
],
292+
"T": [
293+
"R",
294+
"F",
295+
"G",
296+
"Y"
297+
],
298+
"U": [
299+
"Y",
300+
"H",
301+
"J",
302+
"I"
303+
],
304+
"V": [
305+
"C",
306+
"F",
307+
"G",
308+
"V",
309+
"B"
310+
],
311+
"W": [
312+
"Q",
313+
"A",
314+
"S",
315+
"E"
316+
],
317+
"X": [
318+
"Z",
319+
"S",
320+
"D",
321+
"C"
322+
],
323+
"Y": [
324+
"T",
325+
"G",
326+
"H",
327+
"U"
328+
],
329+
"Z": [
330+
"A",
331+
"S",
332+
"X"
333+
]
334+
}

0 commit comments

Comments
 (0)