nyukat / GMIC

An interpretable classifier for high-resolution breast cancer screening images utilizing weakly supervised localization
https://doi.org/10.1016/j.media.2020.101908
GNU Affero General Public License v3.0
163 stars 48 forks source link

modules.py error #5

Closed ankitdata closed 4 years ago

ankitdata commented 4 years ago

After running breast_cancer_classifier, i copied cropped images, data.pkl and cropped_exam_list.pkl into GMIC/sample_data and then ran bash run.sh command. Getting below error

Traceback (most recent call last): File "src/scripts/run_model.py", line 297, in main() File "src/scripts/run_model.py", line 293, in main turn_on_visualization=args.visualization_flag, File "src/scripts/run_model.py", line 253, in start_experiment output_df = run_single_model(single_model_path, data_path, parameters, turn_on_visualization) File "src/scripts/run_model.py", line 218, in run_single_model output_df = run_model(model, exam_list, parameters, turn_on_visualization) File "src/scripts/run_model.py", line 181, in run_model output = model(tensor_batch) File "/home/username/lib/python3.5/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/username/GMIC/src/modeling/gmic.py", line 123, in forward small_x_locations = self.retrieve_roi_crops.forward(x_original, self.cam_size, self.saliency_map) File "/home/username/GMIC/src/modeling/modules.py", line 339, in forward assert h_h == h, "h_h!=h" AssertionError: h_h!=h

seyiqi commented 4 years ago

Hi,

Did you installed the requirements.txt?

Also when running the run.sh, are you in the project directory? (i.e. you are in /path/to/GMIC/)

ankitdata commented 4 years ago

Hi,

Yes i installed all dependencies from requirements.txt. and also i am in project directory when running bash run.sh.

I do not have segmentation folder in GMIC/sample_data but i am giving path as it is in run.sh file

below is my data.pkl json structure that I get after running breast cancer classifier and then using it for GMIC run.

[{'distance_from_starting_side': {'R-MLO': [0], 'L-MLO': [0], 'R-CC': [0], 'L-CC': [0]}, 'horizontal_flip': 'NO', 'L-CC': ['L-CC'], 'L-MLO': ['L-MLO'], 'R-MLO': ['R-MLO'], 'rightmost_points': {'R-MLO': [((2492, 2523), 2430)], 'L-MLO': [((2493, 2548), 2556)], 'R-CC': [((2207, 2287), 2326)], 'L-CC': [((1879, 1958), 2389)]}, 'R-CC': ['R-CC'], 'window_location': {'R-MLO': [(0, 3724, 848, 3328)], 'L-MLO': [(0, 3818, 0, 2607)], 'R-CC': [(71, 3771, 952, 3328)], 'L-CC': [(353, 4009, 0, 2440)]}, 'bottommost_points': {'R-MLO': [(3673, (1164, 1184))], 'L-MLO': [(3767, (1456, 1524))], 'R-CC': [(3649, (101, 106))], 'L-CC': [(3605, (100, 100))]}, 'best_center': {'R-MLO': [(2185, 1555)], 'L-MLO': [(2279, 1681)], 'R-CC': [(2173, 1354)], 'L-CC': [(1850, 1417)]}}]

seyiqi commented 4 years ago

This statement is triggered when the feature map (h_g) size is different from cam_size defined in https://github.com/nyukat/GMIC/blob/master/src/scripts/run_model.py#L283.

You could print out the size of h_g and change cam_size accordingly.