ciampluca / counting_perineuronal_nets

Apache License 2.0
9 stars 1 forks source link

problem with predictions #7

Open Noy987 opened 7 months ago

Noy987 commented 7 months ago

I've ran the script on my slice with the datasets - pnn_v2_scoring_rank_learning, pnn_v2_fasterrcnn_640 - and i got only a few PNN marked, do you know why? Is it connected to this error in .hydra\config.yaml or do you suggest doing self training? If so, how is it done? Would really appreciate the help.

image image

I also looked at the self-training models and saw that there are many datasets, but i only need PNN and PV, should i download only the PNN one in the pic below? Thanks! Screenshot 2024-03-01 133253

LeonardoLupori commented 7 months ago

Hi!

Thanks for writing feedback :) I have a few questions to clarify the situation and we will try our best to help:

  1. What's the scale of the images you use for predictions? (in terms of micrometers per pixel)

I'm asking because the model was trained with relatively high-resolution images with the same scale, so it expects PNNs to be of a certain size in pixels. Small deviations from that scale should not be a big problem. Big deviations in the direction of more resolution can be solved by simply downsampling the images, while unfortunately if your resolution is too low there's not much you can do. You can try a desperate attempt by digitally upscaling the images but we did not test whether upscaled, interpolated images can be used effectively.

  1. When you run predictions when do you get that error? Do you get it every time you run predict.py? If the software crashes, how are you able to get predictions?

Thanks a lot :)

Noy987 commented 7 months ago

Thanks you for the answer :)

  1. I saw there is a limitation for 178,956,970 pixels so i downsized my slice to a matching size, these are the details: 5484*4256=23,339,904 pixels 8-bit 22MB width (pixel) 2742 height (pixel) 2128 Depth (images) 1

how do i know the micrometers per pixel of the slice? To my opinion, the PNN are still visiable enough, would love to her what you think and change the size accoringly. Here is a zoom in of the pic:

Screenshot 2024-03-07 121209

  1. Yes, i get that error everytime. The software doesn't crash, it gives an output. here it is:

Screenshot 2024-03-07 124310

I tried to downsize the image less so we can check the best quality within the limitation of the code and got more patches, but unfortunately the localizations.csv file isn't created (it's not in the folder). These are the dimensions: 15185*11784=178,940,040 pixel

Screenshot 2024-03-07 152754

Thank you!!

fabiocarrara commented 7 months ago

About the FileNotFound error, check if, when unzipping the pretrained model, you also unzipped the .hydra/ folder and it is present in the pnn_v2_fasterrcnn_640/ folder. Files prepended with the dot character are often considered hidden files, and you might have skipped it while unzipping. The folder contains a configuration file with the correct parameters of the pretrained model. Not loading that file could cause the software to malfunction.

Noy987 commented 7 months ago

Thank you, i will try that.

Regarding the scale of the images - I checked with the lab, and wanted to ask what is the size and resolution in your imaging? We can match ours accordingly. Thanks!

LeonardoLupori commented 7 months ago

Sorry for the delay

Regarding the scale of the images - I checked with the lab, and wanted to ask what is the size and resolution in your imaging? We can match ours accordingly. Thanks!

As a troubleshooting step, you can also try to download the raw images dataset in the paper at this link and try to predict one of the raw images here: https://zenodo.org/records/7419283 If that does not work, then we know that whatever is not working correctly is not in the images but in the prediction process

Let us know if this helps :)

Noy987 commented 7 months ago

Thank you for the feedback! I will try it out!