Lydorn / Polygonization-by-Frame-Field-Learning

This repository contains the code for our fast polygonal building extraction from overhead images pipeline.
BSD 3-Clause "New" or "Revised" License
284 stars 67 forks source link

error in running main.py #7

Open lpy5618 opened 3 years ago

lpy5618 commented 3 years ago

When I run main.py, I get the following error, I am afraid to modify the code because I am afraid that it will cause more errors, please help me to solve this problem,thx!

Traceback (most recent call last): File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 375, in main() File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 367, in main launch_train(args) File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 230, in launch_train torch.multiprocessing.spawn(train_process, nprocs=args.gpus, args=(config, shared_dict, barrier)) File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 200, in spawn return start_processes(fn, args, nprocs, join, daemon, start_method='spawn') File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 158, in start_processes while not context.join(): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 119, in join raise Exception(msg) Exception:

-- Process 0 terminated with the following error: Traceback (most recent call last): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 20, in _wrap fn(i, *args) File "I:\project\Polygonization-by-Frame-Field-Learning-master\child_processes.py", line 19, in train_process root_dir_candidates = [os.path.join(data_dirpath, config["dataset_params"]["root_dirname"]) for data_dirpath in config["data_dir_candidates"]] File "I:\project\Polygonization-by-Frame-Field-Learning-master\child_processes.py", line 19, in root_dir_candidates = [os.path.join(data_dirpath, config["dataset_params"]["root_dirname"]) for data_dirpath in config["data_dir_candidates"]] TypeError: list indices must be integers or slices, not str

Lydorn commented 3 years ago

Looking at the error message, it looks like either config or config["dataset_params"] is a list, but both should be dictionaries... As I've never had this error it's hard to know why though.

Can you send me the exact command you used to launch main.py? And any things you might have modified in the code or config files.

lpy5618 commented 3 years ago

Looking at the error message, it looks like either config or config["dataset_params"] is a list, but both should be dictionaries... As I've never had this error it's hard to know why though.

Can you send me the exact command you used to launch main.py? And any things you might have modified in the code or config files.

I used pycharm to run main.py, before I got this error, I copied the content in config.defaults.json and created config.json,I did modify some code and config, here is where I changed.

In main.py line 49 before my change:

argparser.add_argument( '-c', '--config', type=str, help='Name of the config file, excluding the .json file extension.')

after:

argparser.add_argument( '-c', '--config', type=str, default='config', help='Name of the config file, excluding the .json file extension.')

In config.json: I added the following code: "dataset_params": [ "/project/Polygonization-by-Frame-Field-Learning-master/data" ], it is the path to the dataset on my pc,and then I got that error.

Maybe there are some errors in my method of solving the problem. I am still a student and I am studying hard. I hope you can help me. Thank you very much!

Lydorn commented 3 years ago

Ah I see, actually config.defaults.json is used by other config files as a base but is not complete on its own so it should not be used (or used as a template). It is best to copy and modify config.mapping_dataset.unet_resnet101_pretrained.json for example. You can see it is very short because it references other config files (which you can modify too). Configuration files have a tree structure as explained in the README of the config folder.

Also, the path to the data folder should be set with the "data_dir_candidates" key of the config file, and not the "dataset_params" key as you have done. In your case, I recommend directly modifying config.defaults.json like so:

Before: "data_dir_candidates": [ "/data/titane/user/nigirard/data", // Try cluster /data directory "~/data", // In home directory (docker) "/data" // In landsat's /data volume (docker) ] ...

After: "data_dir_candidates": [ "/project/Polygonization-by-Frame-Field-Learning-master/data" ] ...

Lydorn commented 3 years ago

@lpy5618 Hi, did you manage to run the code as you want?

XiaoyuSun-hub commented 3 years ago

When I run main.py, I get the following error, I am afraid to modify the code because I am afraid that it will cause more errors, please help me to solve this problem,thx!

Traceback (most recent call last): File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 375, in main() File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 367, in main launch_train(args) File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 230, in launch_train torch.multiprocessing.spawn(train_process, nprocs=args.gpus, args=(config, shared_dict, barrier)) File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 200, in spawn return start_processes(fn, args, nprocs, join, daemon, start_method='spawn') File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 158, in start_processes while not context.join(): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 119, in join raise Exception(msg) Exception:

-- Process 0 terminated with the following error: Traceback (most recent call last): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 20, in _wrap fn(i, *args) File "I:\project\Polygonization-by-Frame-Field-Learning-master\child_processes.py", line 19, in train_process root_dir_candidates = [os.path.join(data_dirpath, config["dataset_params"]["root_dirname"]) for data_dirpath in config["data_dir_candidates"]] File "I:\project\Polygonization-by-Frame-Field-Learning-master\child_processes.py", line 19, in root_dir_candidates = [os.path.join(data_dirpath, config["dataset_params"]["root_dirname"]) for data_dirpath in config["data_dir_candidates"]] TypeError: list indices must be integers or slices, not str

@lpy5618 ,could you please share your conda virtual enviroment file (environment.yml) with me? I met problems when installing environment in windows 10. My email is sunxiaoyu_2009@126.com. thank you very much!

lpy5618 commented 3 years ago

Sorry for my late reply. Actually, I have to pay more attention to my courses these months, so I haven't tried it for a long time. Maybe I will try to run it after my final exam, thank you for remembering my issue~ Have a nice day~~~

Nicolas Girard notifications@github.com 于2020年11月11日周三 上午1:09写道:

@lpy5618 https://github.com/lpy5618 Hi, did you manage to run the code as you want?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lydorn/Polygonization-by-Frame-Field-Learning/issues/7#issuecomment-724839445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN7H56AVSPJHLJ5AWAWAOS3SPFXVHANCNFSM4SK6H2BA .

lpy5618 commented 3 years ago

Actually, I didn't succeed in running this project, so I don't know if the file is useful for you.

xiaoyu sun notifications@github.com 于2020年12月1日周二 下午4:26写道:

When I run main.py, I get the following error, I am afraid to modify the code because I am afraid that it will cause more errors, please help me to solve this problem,thx!

Traceback (most recent call last): File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 375, in main() File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 367, in main launch_train(args) File "I:/project/Polygonization-by-Frame-Field-Learning-master/main.py", line 230, in launch_train torch.multiprocessing.spawn(train_process, nprocs=args.gpus, args=(config, shared_dict, barrier)) File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 200, in spawn return start_processes(fn, args, nprocs, join, daemon, start_method='spawn') File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 158, in start_processes while not context.join(): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 119, in join raise Exception(msg) Exception:

-- Process 0 terminated with the following error: Traceback (most recent call last): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\multiprocessing\spawn.py", line 20, in _wrap fn(i, *args) File "I:\project\Polygonization-by-Frame-Field-Learning-master\child_processes.py", line 19, in train_process root_dir_candidates = [os.path.join(data_dirpath, config["dataset_params"]["root_dirname"]) for data_dirpath in config["data_dir_candidates"]] File "I:\project\Polygonization-by-Frame-Field-Learning-master\child_processes.py", line 19, in root_dir_candidates = [os.path.join(data_dirpath, config["dataset_params"]["root_dirname"]) for data_dirpath in config["data_dir_candidates"]] TypeError: list indices must be integers or slices, not str

@lpy5618 https://github.com/lpy5618 ,could you please share your conda virtual enviroment file (environment.yml) with me? I met problems when installing environment in windows 10. My email is sunxiaoyu_2009@126.com. thank you very much!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lydorn/Polygonization-by-Frame-Field-Learning/issues/7#issuecomment-736307462, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN7H56C5NJTURH5OBPBSMRLSSSSELANCNFSM4SK6H2BA .