File size: 6,697 Bytes
194f9ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91860ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
---
dataset_info:
  features:
  - name: image
    dtype: image
  - name: bbox
    struct:
    - name: ymin
      dtype: int64
    - name: xmin
      dtype: int64
    - name: ymax
      dtype: int64
    - name: xmax
      dtype: int64
  - name: family
    dtype:
      class_label:
        names:
          '0': A300
          '1': A310
          '2': A320
          '3': A330
          '4': A340
          '5': A380
          '6': ATR-42
          '7': ATR-72
          '8': An-12
          '9': BAE 146
          '10': BAE-125
          '11': Beechcraft 1900
          '12': Boeing 707
          '13': Boeing 717
          '14': Boeing 727
          '15': Boeing 737
          '16': Boeing 747
          '17': Boeing 757
          '18': Boeing 767
          '19': Boeing 777
          '20': C-130
          '21': C-47
          '22': CRJ-200
          '23': CRJ-700
          '24': Cessna 172
          '25': Cessna 208
          '26': Cessna Citation
          '27': Challenger 600
          '28': DC-10
          '29': DC-3
          '30': DC-6
          '31': DC-8
          '32': DC-9
          '33': DH-82
          '34': DHC-1
          '35': DHC-6
          '36': DR-400
          '37': Dash 8
          '38': Dornier 328
          '39': EMB-120
          '40': Embraer E-Jet
          '41': Embraer ERJ 145
          '42': Embraer Legacy 600
          '43': Eurofighter Typhoon
          '44': F-16
          '45': F/A-18
          '46': Falcon 2000
          '47': Falcon 900
          '48': Fokker 100
          '49': Fokker 50
          '50': Fokker 70
          '51': Global Express
          '52': Gulfstream
          '53': Hawk T1
          '54': Il-76
          '55': King Air
          '56': L-1011
          '57': MD-11
          '58': MD-80
          '59': MD-90
          '60': Metroliner
          '61': PA-28
          '62': SR-20
          '63': Saab 2000
          '64': Saab 340
          '65': Spitfire
          '66': Tornado
          '67': Tu-134
          '68': Tu-154
          '69': Yak-42
  - name: manufacturer
    dtype:
      class_label:
        names:
          '0': ATR
          '1': Airbus
          '2': Antonov
          '3': Beechcraft
          '4': Boeing
          '5': Bombardier Aerospace
          '6': British Aerospace
          '7': Canadair
          '8': Cessna
          '9': Cirrus Aircraft
          '10': Dassault Aviation
          '11': Dornier
          '12': Douglas Aircraft Company
          '13': Embraer
          '14': Eurofighter
          '15': Fairchild
          '16': Fokker
          '17': Gulfstream Aerospace
          '18': Ilyushin
          '19': Lockheed Corporation
          '20': Lockheed Martin
          '21': McDonnell Douglas
          '22': Panavia
          '23': Piper
          '24': Robin
          '25': Saab
          '26': Supermarine
          '27': Tupolev
          '28': Yakovlev
          '29': de Havilland
  - name: variant
    dtype:
      class_label:
        names:
          '0': 707-320
          '1': 727-200
          '2': 737-200
          '3': 737-300
          '4': 737-400
          '5': 737-500
          '6': 737-600
          '7': 737-700
          '8': 737-800
          '9': 737-900
          '10': 747-100
          '11': 747-200
          '12': 747-300
          '13': 747-400
          '14': 757-200
          '15': 757-300
          '16': 767-200
          '17': 767-300
          '18': 767-400
          '19': 777-200
          '20': 777-300
          '21': A300B4
          '22': A310
          '23': A318
          '24': A319
          '25': A320
          '26': A321
          '27': A330-200
          '28': A330-300
          '29': A340-200
          '30': A340-300
          '31': A340-500
          '32': A340-600
          '33': A380
          '34': ATR-42
          '35': ATR-72
          '36': An-12
          '37': BAE 146-200
          '38': BAE 146-300
          '39': BAE-125
          '40': Beechcraft 1900
          '41': Boeing 717
          '42': C-130
          '43': C-47
          '44': CRJ-200
          '45': CRJ-700
          '46': CRJ-900
          '47': Cessna 172
          '48': Cessna 208
          '49': Cessna 525
          '50': Cessna 560
          '51': Challenger 600
          '52': DC-10
          '53': DC-3
          '54': DC-6
          '55': DC-8
          '56': DC-9-30
          '57': DH-82
          '58': DHC-1
          '59': DHC-6
          '60': DHC-8-100
          '61': DHC-8-300
          '62': DR-400
          '63': Dornier 328
          '64': E-170
          '65': E-190
          '66': E-195
          '67': EMB-120
          '68': ERJ 135
          '69': ERJ 145
          '70': Embraer Legacy 600
          '71': Eurofighter Typhoon
          '72': F-16A/B
          '73': F/A-18
          '74': Falcon 2000
          '75': Falcon 900
          '76': Fokker 100
          '77': Fokker 50
          '78': Fokker 70
          '79': Global Express
          '80': Gulfstream IV
          '81': Gulfstream V
          '82': Hawk T1
          '83': Il-76
          '84': L-1011
          '85': MD-11
          '86': MD-80
          '87': MD-87
          '88': MD-90
          '89': Metroliner
          '90': Model B200
          '91': PA-28
          '92': SR-20
          '93': Saab 2000
          '94': Saab 340
          '95': Spitfire
          '96': Tornado
          '97': Tu-134
          '98': Tu-154
          '99': Yak-42
  splits:
  - name: train
    num_bytes: 879465161.444
    num_examples: 3334
  - name: validation
    num_bytes: 866544443.931
    num_examples: 3333
  - name: test
    num_bytes: 874244310.534
    num_examples: 3333
  download_size: 2761722129
  dataset_size: 2620253915.909
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: validation
    path: data/validation-*
  - split: test
    path: data/test-*
---
## Code snippet to visualise the position of the box

```python
import matplotlib.image as img
import matplotlib.pyplot as plt
from datasets import load_dataset
from matplotlib.patches import Rectangle

# Load dataset
ds_name = "HuggingFaceM4/FGVC-Aircraft"
ds = load_dataset(ds_name, use_auth_token=True)

# Extract information for the sample we want to show
index = 300
sample = ds["train"][index]
box_coord = sample["bbox"]
xmin = box_coord["xmin"]
ymin = box_coord["ymin"]
xmax = box_coord["xmax"]
ymax = box_coord["ymax"]
img_path = sample["image"].filename

# Create plot
# define Matplotlib figure and axis
fig, ax = plt.subplots()

# plot figure
image = img.imread(img_path)
ax.imshow(image)

# add rectangle to plot
ax.add_patch(
    Rectangle((xmin, ymin), xmax-xmin, ymax - ymin, fill=None)
)

# display plot
plt.show()
```