Commit ad70caf61e501cd876a0aca3bc5c089e30a6f7ba

Authored by Chunk
1 parent 554a7b9a
Exists in master and in 1 other branch refactor

staged.

@@ -99,7 +99,7 @@ class DataCV(DataDumperBase): @@ -99,7 +99,7 @@ class DataCV(DataDumperBase):
99 return table 99 return table
100 100
101 101
102 - def store_image(self): 102 + def store_img(self):
103 if self.table == None: 103 if self.table == None:
104 self.table = self.get_table() 104 self.table = self.get_table()
105 105
mdata/ILSVRC.py
@@ -292,7 +292,7 @@ class DataILSVRC(DataDumperBase): @@ -292,7 +292,7 @@ class DataILSVRC(DataDumperBase):
292 return table 292 return table
293 293
294 294
295 - def store_image(self): 295 + def store_img(self):
296 if self.table == None: 296 if self.table == None:
297 self.table = self.get_table() 297 self.table = self.get_table()
298 298
@@ -302,7 +302,7 @@ class DataILSVRC(DataDumperBase): @@ -302,7 +302,7 @@ class DataILSVRC(DataDumperBase):
302 tsvfile = csv.reader(tsvfile, delimiter='\t') 302 tsvfile = csv.reader(tsvfile, delimiter='\t')
303 for line in tsvfile: 303 for line in tsvfile:
304 path_img = os.path.join(self.img_dir, line[0][:3], line[0][3:] + '.jpg') 304 path_img = os.path.join(self.img_dir, line[0][:3], line[0][3:] + '.jpg')
305 - if path_img: 305 + if path_img:
306 with open(path_img, 'rb') as fpic: 306 with open(path_img, 'rb') as fpic:
307 dict_databuf[line[0] + '.jpg'] = fpic.read() 307 dict_databuf[line[0] + '.jpg'] = fpic.read()
308 308
@@ -101,7 +101,7 @@ class DataMSR(DataDumperBase): @@ -101,7 +101,7 @@ class DataMSR(DataDumperBase):
101 return table 101 return table
102 102
103 103
104 - def store_image(self): 104 + def store_img(self):
105 if self.table == None: 105 if self.table == None:
106 self.table = self.get_table() 106 self.table = self.get_table()
107 107
@@ -265,4 +265,4 @@ class DataMSR(DataDumperBase): @@ -265,4 +265,4 @@ class DataMSR(DataDumperBase):
265 X.append(data[0]) 265 X.append(data[0])
266 Y.append(data[1]) 266 Y.append(data[1])
267 267
268 - return X, Y  
269 \ No newline at end of file 268 \ No newline at end of file
  269 + return X, Y
test/test_data.py
@@ -31,25 +31,29 @@ def test_CV(): @@ -31,25 +31,29 @@ def test_CV():
31 def test_ILSVRC(): 31 def test_ILSVRC():
32 timer = Timer() 32 timer = Timer()
33 # dil = ILSVRC.DataILSVRC(base_dir='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val', category='Train') 33 # dil = ILSVRC.DataILSVRC(base_dir='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val', category='Train')
34 - # dil = ILSVRC.DataILSVRC(base_dir='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val', category='Test')  
35 - dil = ILSVRC.DataILSVRC(base_dir='/media/chunk/Elements/D/data/ImageNet/img/ILSVRC2013_DET_val', category='Train_1') 34 + dil = ILSVRC.DataILSVRC(base_dir='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val', category='Train_1')
  35 + # dil = ILSVRC.DataILSVRC(base_dir='/media/chunk/Elements/D/data/ImageNet/img/ILSVRC2013_DET_val', category='Train_1')
36 36
37 - # dil.format()  
38 - # dil.embed(rate=0.1)  
39 - # dil.extract_feat(feattype='ibd') 37 + dil.format()
  38 + dil.embed(rate=0.1)
  39 + dil.extract_feat(feattype='ibd')
40 # dil.extract_feat(feattype='hog') 40 # dil.extract_feat(feattype='hog')
41 41
42 timer.mark() 42 timer.mark()
43 dil.store_img() 43 dil.store_img()
44 timer.report() 44 timer.report()
45 - # 45 +
  46 + timer.mark()
  47 + dil.store_tag()
  48 + timer.report()
  49 +
46 timer.mark() 50 timer.mark()
47 dil.store_info() 51 dil.store_info()
48 timer.report() 52 timer.report()
49 53
50 - # timer.mark()  
51 - # dil.store_info()  
52 - # timer.report() 54 + timer.mark()
  55 + dil.store_feat()
  56 + timer.report()
53 57
54 58
55 if __name__ == '__main__': 59 if __name__ == '__main__':