PathologyDataScience / HistomicsML2

A tool for training machine-learning models with whole-slide imaging datasets
22 stars 5 forks source link

Prediction for all superpixels #71

Closed Reasat closed 3 years ago

Reasat commented 3 years ago

How can I extract predictions for all of the superpixels from the classifier?

In the example BRCA dataset, after I finish the active learning part and hit finalize, I navigate to the reports tab. Screenshot from 2020-11-30 00-06-13

Slide summary inference gives the number of positive and negative superpixels. The .h5 file from the Download classifier section only contains superpixel information that I have manually annotated but does not contain info about the predictions.

But I don't see the predict slides portion as reported in the docs https://histomicsml2.readthedocs.io/en/latest/reports.html Also, the Command-line tools part of the doc is not very clear. It says to execute docker run to create results for superpixel inference. Shouldn't there be another argument after docker run? And how do I proceed to make this work for the example BRCA dataset?

slee172 commented 3 years ago

@Reasat In order to avoid a huge amount of memory consumption, we provide a command-line tool with some parameters. For this, I just updated a python script "generate_mask_cmd.py" here, so you download and use it for generating the entire mask. You can also generate a mask (ROI) using the "Mask Image Inference" for the prediction. FYI, here's a rough instruction for you to use the code.

  1. Download the generate_mask_cmd.py
  2. Copy generate_mask_cmd.py to your docker image i.e) docker cp generate_mask_cmd.py de5a17376f57:/var/www/html/predict-rest-api/ (de5a17376f57 is a CONTAINER ID of cancerdatascience/histomicsml:examle)
  3. Go to the container and run the code. i.e) python generate_mask_cmd.py /datasets/BRCA/BRCA-spfeatures-1.h5 /datasets/models/test.h5 /datasets/BRCA/tif/TCGA-A2-A3XS-01Z-00-DX1.svs.dzi.tif ./ (The first parameter is the dataset, the second parameter is a model you created, the third parameter is the location of the slide, the fourth parameter is the location of the output file). There are more parameters you can use in the code. Hope this would help you.