Weakly_detector icon indicating copy to clipboard operation
Weakly_detector copied to clipboard

TypeError: 'map' object is not subscriptable

Open YangBain opened this issue 7 years ago • 9 comments

@jazzsaxmafia Hello, :\Tesnsorflow\Weaklydetector\src>python train.caltech.py Traceback (most recent call last): File "train.caltech.py", line 44, in image_paths_train = np.hstack(map(lambda one_class: one_class[:-10], image_paths_per_label)) File "C:\Program Files\Anaconda3\lib\site-packages\numpy\core\shape_base.py", line 275, in hstack arrs = [atleast_1d(_m) for _m in tup] File "C:\Program Files\Anaconda3\lib\site-packages\numpy\core\shape_base.py", line 275, in arrs = [atleast_1d(_m) for _m in tup] File "train.caltech.py", line 44, in image_paths_train = np.hstack(map(lambda one_class: one_class[:-10], image_paths_per_label)) TypeError: 'map' object is not subscriptable


:\Tesnsorflow\Weaklydetector\src>python train.caltech.py Traceback (most recent call last): File "train.caltech.py", line 40, in image_paths_train = np.hstack(list(map(lambda one_class: one_class[:-10], image_paths_per_label))) File "train.caltech.py", line 40, in image_paths_train = np.hstack(list(map(lambda one_class: one_class[:-10], image_paths_per_label))) TypeError: 'map' object is not subscriptable

Any idea of this problem? Thank you very much.

YangBain avatar Oct 20 '17 06:10 YangBain

Hello,I have a question.Where is the "caffe_layers_value.pickle"?

Sabergu avatar Oct 26 '17 09:10 Sabergu

I have the same issue,

my1347 avatar Nov 05 '17 13:11 my1347

@my1347 add list before map, just like list(map()), you can solve your problems.

YangBain avatar Nov 06 '17 08:11 YangBain

@YangBain already do that, but it didn't work

my1347 avatar Nov 11 '17 05:11 my1347

I know this is a few months old, but I just encountered same issue and fixed.

@my1347 did you do it for the lines before np.hstack? image_paths_per_label is a map and trying to be subscribed in the next line, so the list conversion also has to happen on the preceeding line as well.

eanderson4 avatar Feb 28 '18 18:02 eanderson4

@eanderson4 I use python3.5.4 ,modified like this: image_paths_per_label = list(map(lambda one_dir: map(lambda one_file: os.path.join( dataset_path, one_dir, one_file ), os.listdir( os.path.join( dataset_path, one_dir))), image_dir_list)) image_paths_train = np.hstack(list(map(lambda one_class: one_class[:-10], image_paths_per_label)))

it still do not work ,same problem

lz666win avatar Sep 03 '18 14:09 lz666win

@lz666win In that line there are two map (which is marked bold below) , if you replace that also with list(map) it works

image_paths_per_label = list(map(lambda one_dir: map(lambda one_file: os.path.join( dataset_path, one_dir, one_file ), os.listdir( os.path.join( dataset_path, one_dir))), image_dir_list))

Rahul-Venugopal avatar Jan 03 '19 22:01 Rahul-Venugopal

same issue

bossajie avatar Aug 30 '19 01:08 bossajie

I know this is a few months old, but I just encountered same issue and fixed.

@my1347 did you do it for the lines before np.hstack? image_paths_per_label is a map and trying to be subscribed in the next line, so the list conversion also has to happen on the preceeding line as well.

can more explain to me how can i do to fix the issue?

siwarsiw avatar May 17 '21 09:05 siwarsiw