Skip to content

IsADirectoryError when loading pretrained point encoder during training #6

@Gweiqi

Description

@Gweiqi

Hi, thank you for sharing this excellent project!
I'm trying to run the training script using the following command:

python train_network.py -d dataset_specs_airway.json

However, I encountered the following error:

_cpu
Project directory: /mnt/c/software/airway_code/airway_lable/pulmonary_tree_labeling
BASE_DIR: /mnt/c/software/airway_code/airway_lable/pulmonary_tree_labeling
dataset_file: dataset_specs_airway.json
Currently processing: Airway
loading pretrain point encoder: /mnt/c/software/airway_code/airway_lable/pulmonary_tree_labeling/ckp/airway/point_encoder
Traceback (most recent call last):
File "/mnt/c/software/airway_code/airway_lable/pulmonary_tree_labeling/train_network.py", line 68, in
train()
File "/mnt/c/software/airway_code/airway_lable/pulmonary_tree_labeling/train_network.py", line 56, in train
encoder_networks_pretrain(train_inf_specs, dataset_specs, PGN, device = device, target = 'point', base_dir = BASE_DIR)
File "/mnt/c/software/airway_code/airway_lable/pulmonary_tree_labeling/model/encoder_pretrain.py", line 135, in encoder_networks_pretrain
model.point_encoder.load_state_dict(torch.load(encoder_save_path))
File ".../torch/serialization.py", line 771, in load
with _open_file_like(f, 'rb') as opened_file:
File ".../torch/serialization.py", line 270, in _open_file_like
return _open_file(name_or_buffer, mode)
File ".../torch/serialization.py", line 251, in init
super(open_file, self).init(open(name, mode))
IsADirectoryError: [Errno 21] Is a directory: '/mnt/c/software/airway_code/airway_lable/pulmonary_tree_labeling/ckp/airway/point_encoder'

It seems the code is trying to load a model file, but the path is a directory, not a .pt or .pkl file.

In that folder I see a file named point_encoder_model.pkl.

Could you please clarify:

Should I manually convert the .pkl file into .pt format?

Or is the code expected to automatically find and load the correct file from the directory?

What's the correct expected file format for pretrained weights?

Any help would be much appreciated. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions