question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: list indices must be integers or slices, not str

See original GitHub issue

Issue description

Terminal output (from Wandb): output.log

log: log.log

version_info.log

Config file
{
    "command": "train",
    "gpu_ids": [4],
    "path_output": "seg_lesion_output",
    "model_name": "seg_lesion_model",
    "debugging": true,
    "object_detection_params": {
        "object_detection_path": null,
        "safety_factor": [1.0, 1.0, 1.0]
    },
    "wandb": {
        "wandb_api_key": "9095e2bc9e4ab445d478c9c8a81759ae908be8c6",
        "project_name": "basel-mp2rage-lesion",
        "group_name": "my_group",
        "run_name": "run-1",
        "log_grads_every": 100
    },
    "loader_parameters": {
        "path_data": ["/home/GRAMES.POLYMTL.CA/p101317/data_nvme_p101317/data_seg_mp2rage_20221212_175444/data_processed_lesionseg"],
        "subject_selection": {
            "n": [],
            "metadata": [],
            "value": []
        },
        "target_suffix": [["_lesion-manual", "_lesion-manual2"]],
        "extensions": [],
        "roi_params": {
            "suffix": null,
            "slice_filter_roi": null
        },
        "contrast_params": {
            "training_validation": ["UNIT1"],
            "testing": ["UNIT1"],
            "balance": {}
        },
        "slice_filter_params": {
            "filter_empty_mask": false,
            "filter_empty_input": false
        },
        "slice_axis": "axial",
        "multichannel": false,
        "soft_gt": false
    },
    "split_dataset": {
        "fname_split": null,
        "random_seed": 42,
        "center_test": [],
        "method": "per_patient",
        "balance": null,
        "train_fraction": 0.75,
        "test_fraction": 0.2
    },
    "training_parameters": {
        "batch_size": 4,
        "loss": {
            "name": "DiceLoss"
        },
        "training_time": {
            "num_epochs": 100,
            "early_stopping_patience": 200,
            "early_stopping_epsilon": 0.001
        },
        "scheduler": {
            "initial_lr": 1e-3,
            "lr_scheduler": {
                "name": "CosineAnnealingLR",
                "base_lr": 1e-5,
                "max_lr": 1e-3
            }
        },
        "balance_samples": {
            "applied": false,
            "type": "gt"
        },
        "mixup_alpha": null,
        "transfer_learning": {
            "retrain_model": null,
            "retrain_fraction": 1.0,
            "reset": true
        }
    },
    "default_model": {
        "name": "Unet",
        "dropout_rate": 0.3,
        "bn_momentum": 0.1,
        "depth": 4,
        "is_2d": false,
        "final_activation": "sigmoid"
    },
    "uncertainty": {
        "epistemic": false,
        "aleatoric": false,
        "n_it": 0
    },
    "postprocessing": {"binarize_prediction": {"thr": 0.5}},
    "evaluation_parameters": {},
    "transformation": {
        "Resample": {
            "wspace": 1.0,
            "hspace": 1.0,
            "dspace": 1.0
        },
        "CenterCrop": {
            "size": [32, 64, 128]
        },
        "RandomReverse": {
            "applied_to": ["im", "gt"],
            "dataset_type": ["training"]
        },
        "RandomAffine": {
            "degrees": 10,
            "scale": [0.2, 0.2, 0.2],
            "translate": [0.2, 0.2, 0.2],
            "applied_to": ["im", "gt"],
            "dataset_type": ["training"]
        },
        "ElasticTransform": {
            "alpha_range": [25.0, 35.0],
            "sigma_range": [3.5, 5.5],
            "p": 0.5,
            "applied_to": ["im", "gt"],
            "dataset_type": ["training"]
        },
        "RandomGamma": {
            "log_gamma_range": [-1.5, 1.5],
            "p": 0.5,
            "applied_to": ["im"],
            "dataset_type": ["training"]
        },
        "NumpyToTensor": {},
        "NormalizeInstance": {
            "applied_to": ["im"]
        }
    },
    "Modified3DUNet": {
        "applied": true,
        "length_3D": [32, 64, 128],
        "stride_3D": [32, 64, 128],
        "attention": false,
        "n_filters": 8
    }
}

Possibly related to https://github.com/ivadomed/ivadomed/issues/815

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
dyt811commented, Dec 14, 2022

Seems like more testing with 3D test pathway will be required. I will make a note to test that part as well in the Loader V2.

2reactions
jcohenadadcommented, Dec 14, 2022

Thank you very much for the excellent detective work @mariehbourget 🙏 . I’m surprised this hasn’t been caught before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: list indices must be integers or slices, not str
This type error occurs when indexing a list with anything other than integers or slices, as the error mentions. Usually, the most straightforward...
Read more >
TypeError: list indices must be integers or slices, not str
The Python "TypeError: list indices must be integers or slices, not str" occurs when we use a string instead of an integer to...
Read more >
TypeError: list indices must be integers or slices ... - STechies
TypeError: list indices must be integers or slices, not str. Each element in a list in Python has a unique position. This position...
Read more >
TypeError: list indices must be integers or slices, not str
First, array_length should be an integer and not a string: array_length = len(array_dates). Second, your for loop should be constructed ...
Read more >
TypeError: list indices must be integers or slices, not str
The error “typeerror: list indices must be integers or slices, not str” is raised when you try to access a list using string...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found