SaulLu commited on
Commit
d6fc057
1 Parent(s): aaf60c4

use .zip file

Browse files
Caltech-101.py CHANGED
@@ -45,8 +45,7 @@ _HOMEPAGE = "https://data.caltech.edu/records/20086"
45
 
46
  _LICENSE = "CC BY 4.0"
47
 
48
- # _DATA_URL = "brand_new_data/caltech-101.zip"
49
- _DATA_URL = "brand_new_data/caltech-101/101_ObjectCategories.tar.gz"
50
 
51
  _NAMES = [
52
  "accordion",
@@ -180,7 +179,9 @@ class Caltech101(datasets.GeneratorBasedBuilder):
180
  )
181
 
182
  def _split_generators(self, dl_manager):
183
- data_dir = dl_manager.download_and_extract(_DATA_URL)
 
 
184
  return [
185
  datasets.SplitGenerator(
186
  name=datasets.Split.TRAIN,
@@ -212,7 +213,6 @@ class Caltech101(datasets.GeneratorBasedBuilder):
212
 
213
  for class_dir in data_dir.iterdir():
214
  fnames = [image_path for image_path in class_dir.iterdir() if image_path.name.endswith(".jpg")]
215
- assert [image_path for image_path in class_dir.iterdir() if not image_path.name.endswith(".jpg")] == []
216
  # _TRAIN_POINTS_PER_CLASS datapoints are sampled for the train split,
217
  # the others constitute the test split.
218
  if _TRAIN_POINTS_PER_CLASS > len(fnames):
 
45
 
46
  _LICENSE = "CC BY 4.0"
47
 
48
+ _DATA_URL = "caltech-101.zip"
 
49
 
50
  _NAMES = [
51
  "accordion",
 
179
  )
180
 
181
  def _split_generators(self, dl_manager):
182
+ data_root_dir = dl_manager.download_and_extract(_DATA_URL)
183
+ compress_folder_path = [file for file in dl_manager.iter_files(data_root_dir) if Path(file).name == "101_ObjectCategories.tar.gz"][0]
184
+ data_dir = dl_manager.extract(compress_folder_path)
185
  return [
186
  datasets.SplitGenerator(
187
  name=datasets.Split.TRAIN,
 
213
 
214
  for class_dir in data_dir.iterdir():
215
  fnames = [image_path for image_path in class_dir.iterdir() if image_path.name.endswith(".jpg")]
 
216
  # _TRAIN_POINTS_PER_CLASS datapoints are sampled for the train split,
217
  # the others constitute the test split.
218
  if _TRAIN_POINTS_PER_CLASS > len(fnames):
brand_new_data/caltech-101.zip DELETED
File without changes
brand_new_data/caltech-101/101_ObjectCategories.tar.gz.lock DELETED
File without changes
brand_new_data/caltech-101/Annotations.tar DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1717f4e10aa837b05956e3f4c94456527b143eec0d95e935028b30aff40663d8
3
- size 14028800
 
 
 
 
brand_new_data/caltech-101/show_annotation.m DELETED
@@ -1,44 +0,0 @@
1
- function show_annotation(imgfile, annotation_file);
2
- %%
3
- %% imgfile: string
4
- %% annotation_file: string
5
- %%
6
- %% written by by Fei-Fei Li - November 2004
7
- %%
8
-
9
- IMTYPE = 'jpg';
10
- GUIDELINE_MODE = 1;
11
- %% Parameters
12
- %label_abbrev = {'LE', 'RE', 'LN', 'NB', 'RN', 'LM', 'RM'};
13
- LARGEFONT = 28;
14
- MEDFONT = 18;
15
- BIG_WINDOW = get(0,'ScreenSize');
16
- SMALL_WINDOW = [100 100 512 480];
17
-
18
- %% load the annotated data
19
- load(annotation_file, 'box_coord', 'obj_contour');
20
-
21
- %% Read and display image
22
- ima = imread(imgfile);
23
- ff=figure(1); clf; imagesc(ima); axis image; axis ij; hold on;
24
- % black and white images
25
- if length(size(ima))<3
26
- colormap(gray);
27
- end
28
- set(ff,'Position',SMALL_WINDOW);
29
-
30
- %% show box
31
- box_handle = rectangle('position', [box_coord(3), box_coord(1), box_coord(4)-box_coord(3), box_coord(2)-box_coord(1)]);
32
- set(box_handle, 'edgecolor','y', 'linewidth',5);
33
-
34
- %% show contour
35
- for cc = 1:size(obj_contour,2)
36
- if cc < size(obj_contour,2)
37
- plot([obj_contour(1,cc), obj_contour(1,cc+1)]+box_coord(3), [obj_contour(2,cc), obj_contour(2,cc+1)]+box_coord(1), 'r','linewidth',4);
38
- else
39
- plot([obj_contour(1,cc), obj_contour(1,1)]+box_coord(3), [obj_contour(2,cc), obj_contour(2,1)]+box_coord(1), 'r','linewidth',4);
40
- end
41
- end
42
-
43
- title(imgfile);
44
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
brand_new_data/caltech-101/101_ObjectCategories.tar.gz → caltech-101.zip RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:af6ece2f339791ca20f855943d8b55dd60892c0a25105fcd631ee3d6430f9926
3
- size 131740031
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:331234750fc7f77520e50d9565e8b6907b03565e30320da1401130db08c61f91
3
+ size 137414764