CMU-MultimodalSDK icon indicating copy to clipboard operation
CMU-MultimodalSDK copied to clipboard

IndexError: list index out of range

Open fauzivy opened this issue 4 years ago • 6 comments

Hi. I just started to use the dataset but I got problem while following readme. By having this issue I am unable to download the data using the links provided in mmdatasdk.cmu_mosi.highlevel from the code below:

cmumosi_highlevel=mmdatasdk.mmdataset(mmdatasdk.cmu_mosi.highlevel,'cmumosi/')

I tried to read some other issues but still can't manage to find the solution. I hope by raising this issue will solve the problem and might help others who experience the same problem too. Thank you.

The output error is shown here:

IndexError Traceback (most recent call last) in ----> 1 cmumosi_highlevel=mmdatasdk.mmdataset(mmdatasdk.cmu_mosi.highlevel,'cmumosi/')

E:\CMU-MultimodalSDK\CMU-MultimodalSDK\mmsdk\mmdatasdk\dataset\dataset.py in init(self, recipe, destination) 28 elif type(recipe) is dict: 29 for entry, address in recipe.items(): ---> 30 self.computational_sequences[entry]=computational_sequence(address,destination) 31 32 elif type(recipe) is list:

E:\CMU-MultimodalSDK\CMU-MultimodalSDK\mmsdk\mmdatasdk\computational_sequence\computational_sequence.py in init(self, resource, destination, validate) 31 def init(self,resource, destination=None, validate=True): 32 #initializing the featureset ---> 33 self.__initialize(resource,destination,validate) 34 35 #BACKWARD: backward compatibility

E:\CMU-MultimodalSDK\CMU-MultimodalSDK\mmsdk\mmdatasdk\computational_sequence\computational_sequence.py in __initialize(self, resource, destination, validate) 114 #reading from url or folder - main_file is where the data should go and resource is the url 115 else: --> 116 self.__initialize_from_csd(resource,destination,validate) 117 118

E:\CMU-MultimodalSDK\CMU-MultimodalSDK\mmsdk\mmdatasdk\computational_sequence\computational_sequence.py in __initialize_from_csd(self, resource, destination, validate) 74 log.error("Destination needs to be a folder where the downloaded computational sequence is stored. Exiting ...!",error=True) 75 ---> 76 read_URL(resource,destination) 77 self.resource=resource 78 self.main_file=destination

E:\CMU-MultimodalSDK\CMU-MultimodalSDK\mmsdk\mmdatasdk\computational_sequence\download_ops.py in read_URL(url, destination) 13 log.error("Destination is not specified when downloading data",error=True) 14 ---> 15 if os.path.isdir(destination.rsplit(os.sep,1)[-2]) is False: 16 os.mkdir(destination.rsplit(os.sep,1)[-2]) 17

IndexError: list index out of range

fauzivy avatar Jan 28 '21 05:01 fauzivy

I also encountered the same problem,is your system is also Windows?Hope to get a solution

bourne-3 avatar Jan 28 '21 09:01 bourne-3

@bourne-3 yes, mine is Windows, and still haven't solved it yet

fauzivy avatar Jan 29 '21 00:01 fauzivy

Hi @fauzivy @bourne-3,

I have never tried the sdk on windows. However based on the error it seems a problem when trying to figure out the path. Seems like if os.path.isdir(destination.rsplit(os.sep,1)[-2]) is False: does not have a consistent behavior between linux and windows. Any chance you can migrate to linux?

A2Zadeh avatar Jan 29 '21 00:01 A2Zadeh

Thank you @A2Zadeh for the explanation but unfornately I'm not capable to migrate to Linux. Any other suggestion?

fauzivy avatar Jan 31 '21 09:01 fauzivy

It is because that the os.sep under Windows is actually \\ rather than / under Linux. The solution is simply replace the os.sep with '/' in the following 2 pieces of code:

  1. mmsdk\mmdatasdk\computational_sequence\download_ops.py, line 15:
if os.path.isdir(destination.rsplit(os.sep, 1)[-2]) is False:
    os.mkdir(destination.rsplit(os.sep, 1)[-2])
  1. mmsdk\mmdatasdk\computational_sequence\computational_sequence.py, line 70:
elif '.csd' not in destination:
    destination=os.path.join(destination, resource.split(os.sep)[-1])

npurson avatar Jan 24 '22 08:01 npurson

Thank you @npurson. It worked for me.

HoaiDuyLe avatar Apr 08 '22 06:04 HoaiDuyLe