@@ -50,22 +50,19 @@ def __init__(self, root_path, list_file,
50
50
def _load_image (self , directory , idx , isLast = False ):
51
51
if self .modality == 'RGB' or self .modality == 'RGBDiff' :
52
52
try :
53
- return [Image .open (os .path .join (self .root_path , directory , self .image_tmpl .format (idx ))).convert ('RGB' )]
53
+ return [Image .open (os .path .join (self .root_path , "rgb" , directory , self .image_tmpl .format (idx ))).convert ('RGB' )]
54
54
except Exception :
55
- print ('error loading image:' , os .path .join (self .root_path , directory , self .image_tmpl .format (idx )))
56
- return [Image .open (os .path .join (self .root_path , directory , self .image_tmpl .format (1 ))).convert ('RGB' )]
55
+ print ('error loading image:' , os .path .join (self .root_path , "rgb" , directory , self .image_tmpl .format (idx )))
56
+ return [Image .open (os .path .join (self .root_path , "rgb" , directory , self .image_tmpl .format (1 ))).convert ('RGB' )]
57
57
58
58
elif self .modality == 'Flow' :
59
59
try :
60
- idx_skip = 1 + (idx - 1 ) * 5
61
- flow = Image .open (os .path .join (self .root_path , directory , self .image_tmpl .format (idx_skip ))).convert ('RGB ' )
60
+ x_img = Image . open ( os . path . join ( self . root_path , "flow/u" , directory , self . image_tmpl . format (idx ))). convert ( 'L' )
61
+ y_img = Image .open (os .path .join (self .root_path , "flow/v" , directory , self .image_tmpl .format (idx ))).convert ('L ' )
62
62
except Exception :
63
- print ('error loading flow file:' , os .path .join (self .root_path , directory , self .image_tmpl .format (idx_skip )))
64
- flow = Image .open (os .path .join (self .root_path , directory , self .image_tmpl .format (1 ))).convert ('RGB' )
65
- # the input flow file is RGB image with (flow_x, flow_y, blank) for each channel
66
- flow_x , flow_y , _ = flow .split ()
67
- x_img = flow_x .convert ('L' )
68
- y_img = flow_y .convert ('L' )
63
+ print ('error loading flow file:' , os .path .join (self .root_path , "flow/v" , directory , self .image_tmpl .format (idx )))
64
+ x_img = Image .open (os .path .join (self .root_path , "flow/u" , directory , self .image_tmpl .format (1 ))).convert ('L' )
65
+ y_img = Image .open (os .path .join (self .root_path , "flow/v" , directory , self .image_tmpl .format (1 ))).convert ('L' )
69
66
return [x_img , y_img ]
70
67
71
68
elif self .modality == 'RGBFlow' :
@@ -122,7 +119,7 @@ def __getitem__(self, index):
122
119
index = np .random .randint (len (self .video_list ))
123
120
record = self .video_list [index ]
124
121
else :
125
- while not os .path .exists (os .path .join (self .root_path , record .path , self .image_tmpl .format (1 ))):
122
+ while not os .path .exists (os .path .join (self .root_path , "rgb" , record .path , self .image_tmpl .format (1 ))):
126
123
index = np .random .randint (len (self .video_list ))
127
124
record = self .video_list [index ]
128
125
0 commit comments