python - Can't use LFW dataset in sklearn -
it seems fetch_lfw_people function don't work, can't understand why.
here test code:
in [1]: import numpy np in [2]: sklearn import datasets in [3]: lfw= datasets.fetch_lfw_people() ioerror traceback (most recent call last) <ipython-input-3-1f0795d3f6a9> in <module>() ----> 1 lfw= datasets.fetch_lfw_people() c:\python27\lib\site-packages\sklearn\datasets\lfw.pyc in fetch_lfw_people(data_ home, funneled, resize, min_faces_per_person, color, slice_, download_if_missing ) 270 faces, target, target_names = load_func( 271 data_folder_path, resize=resize, --> 272 min_faces_per_person=min_faces_per_person, color=color, slice_=s lice_) 273 274 # pack results bunch instance c:\python27\lib\site-packages\sklearn\externals\joblib\memory.pyc in __call__(se lf, *args, **kwargs) 169 'directory %s' 170 % (name, argument_hash, output_dir)) --> 171 return self.call(*args, **kwargs) 172 else: 173 try: c:\python27\lib\site-packages\sklearn\externals\joblib\memory.pyc in call(self, *args, **kwargs) 321 if self._verbose: 322 print self.format_call(*args, **kwargs) --> 323 output = self.func(*args, **kwargs) 324 self._persist_output(output, output_dir) 325 duration = time.time() - start_time c:\python27\lib\site-packages\sklearn\datasets\lfw.pyc in _fetch_lfw_people(data _folder_path, slice_, color, resize, min_faces_per_person) 195 target = np.searchsorted(target_names, person_names) 196 --> 197 faces = _load_imgs(file_paths, slice_, color, resize) 198 199 # shuffle faces deterministic rng scheme avoid having c:\python27\lib\site-packages\sklearn\datasets\lfw.pyc in _load_imgs(file_paths, slice_, color, resize) 149 if % 1000 == 0: 150 logger.info("loading face #%05d / %05d", + 1, n_faces) --> 151 face = np.asarray(imread(file_path)[slice_], dtype=np.float32) 152 face /= 255.0 # scale uint8 coded colors [0.0, 1.0] floa ts 153 if resize not none: c:\python27\lib\site-packages\scipy\misc\pilutil.pyc in imread(name, flatten) 100 """ 101 --> 102 im = image.open(name) 103 return fromimage(im,flatten=flatten) 104 c:\python27\lib\site-packages\pil\image.pyc in open(fp, mode) 1978 pass 1979 -> 1980 raise ioerror("cannot identify image file") 1981 1982 # ioerror: cannot identify image file
Comments
Post a Comment