MrGiovanni / AbdomenAtlas

[NeurIPS 2023] AbdomenAtlas 1.0 (5,195 CT volumes + 9 annotated classes)
https://www.cs.jhu.edu/~alanlab/Pubs23/qu2023abdomenatlas.pdf
Other
204 stars 14 forks source link

The shape of the generated label does not match the original image. #1

Closed chenluda closed 1 year ago

chenluda commented 1 year ago

I encountered a minor issue when running your code: the shape of the generated label does not match the original image. Here are the details: I used the epoch_450.pth file provided by you (seems like a beta version :>), and tested it on a private dataset.

The shape of my original image is [64, 368, 576], while the shape of the generated label is [127, 171, 267]. They appear like this in 3D Slicer: image

I'm wondering if this is due to my operation or if it's a bug?


In addition, regarding lines 233-241 in test.py:

    #Load pre-trained weights
    store_dict = model.state_dict()
    checkpoint = torch.load(args.resume)
    load_dict = checkpoint['net']
    # args.epoch = checkpoint['epoch']

    for key, value in load_dict.items():
        name = '.'.join(key.split('.')[1:])
        store_dict[name] = value

The key in store_dict will have an additional 'backbone.' ,while the key in load_dict seem to have an additional 'module.' due to the use of nn.DataParallel during training and do not have a 'backbone.'.

In this case, the above code may not work properly.

You can directly use:

    #Load pre-trained weights
    store_dict = model.state_dict()
    store_dict_keys = [key for key, value in store_dict.items()]
    checkpoint = torch.load(args.resume)
    load_dict = checkpoint['net']
    load_dict_value = [value for key, value in load_dict.items()]
    # args.epoch = checkpoint['epoch']

    for i in range(len(store_dict)):
        store_dict[store_dict_keys[i]] = load_dict_value[i]
ollie-ztz commented 1 year ago

Hi @chenluda,

Thank you for showing interest in our project. And I appreciate your helpful suggestions for our project.

Thank you for your suggestions regarding the store_dict.