Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'map' object is not subscriptable #10

Open
YangBain opened this issue Oct 20, 2017 · 9 comments
Open

TypeError: 'map' object is not subscriptable #10

YangBain opened this issue Oct 20, 2017 · 9 comments

Comments

@YangBain
Copy link

@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.

@Sabergu
Copy link

Sabergu commented Oct 26, 2017

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

@my1347
Copy link

my1347 commented Nov 5, 2017

I have the same issue,

@YangBain
Copy link
Author

YangBain commented Nov 6, 2017

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

@my1347
Copy link

my1347 commented Nov 11, 2017

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

@eanderson4
Copy link

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.

@lz666win
Copy link

lz666win commented Sep 3, 2018

@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

@Rahul-Venugopal
Copy link

Rahul-Venugopal commented Jan 3, 2019

@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))

@bossajie
Copy link

same issue

@siwarsiw
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants