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

Exception in train.py - Can't pickle local object 'train_detector.<locals>.<lambda> #17

Open
johannesTech opened this issue Feb 3, 2022 · 1 comment

Comments

@johannesTech
Copy link

Hello @Teoge,
first of all, thank you for sharing your research together with your code here!

I tried to execute your code and the inference ran flawlessly. Unfortunately, the training is not running due to the following error at location

DMPR-PS/train.py

Lines 73 to 79 in 88b77e3

data_loader = DataLoader(data.ParkingSlotDataset(args.dataset_directory),
batch_size=args.batch_size, shuffle=True,
num_workers=args.data_loading_workers,
collate_fn=lambda x: list(zip(*x)))
for epoch_idx in range(args.num_epochs):
for iter_idx, (images, marking_points) in enumerate(data_loader):

Exception has occurred: AttributeError Can't pickle local object 'train_detector.<locals>.<lambda>'
This issue is seems to be a result of the lambda function being called in the DataLoader.

I executed your code with python 3.7.0 and torch 1.7.0.

I would appreciate any hint you have for me :)

Best,
Johannes

@Teoge
Copy link
Owner

Teoge commented Feb 9, 2022

Did you run your training on windows? It looks similar to this issue.
You can try the solutions inside, replacing lambda with a normally defined function, or setting num_workers to 0.

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

2 participants