readme: ---
  license: gpl-3.0
  ---
  
  # Lung Adeno/Squam v1 Model Card
  This model card describes the model associated with the manuscript "Uncertainty-informed deep learning models enable high-confidence predictions for digital histopathology", by Dolezal _et al_, available [here](https://www.nature.com/articles/s41467-022-34025-x).
  
  ## Model Details
  - **Developed by:** James Dolezal
  - **Model type:** Deep convolutional neural network image classifier
  - **Language(s):** English
  - **License:** GPL-3.0
  - **Model Description:** This is a model that can classify H&E-stained pathologic images of non-small cell lung cancer into adenocarcinoma or squamous cell carcinoma and provide an estimate of classification uncertainty. It is an [Xception](https://arxiv.org/abs/1610.02357) model with two dropout-enabled hidden layers enabled during both training and inference. During inference, a given image is passed through the network 30 times, resulting in a distribution of predictions. The mean of this distribution is the final prediction, and the standard deviation is the uncertainty.
  - **Image processing:** This model expects images of H&E-stained pathology slides at 299 x 299 px and 302 x 302 μm resolution. Images should be stain-normalized using a modified Reinhard normalizer ("Reinhard-Fast") available [here](https://github.com/jamesdolezal/slideflow/blob/master/slideflow/norm/tensorflow/reinhard.py). The stain normalizer should be fit using the `target_means` and `target_stds` listed in the model `params.json` file. Images should be should be standardized with `tf.image.per_image_standardization()`.
  - **Resources for more information:** [GitHub Repository](https://github.com/jamesdolezal/biscuit), [Paper](https://www.nature.com/articles/s41467-022-34025-x)
  - **Cite as:**
  
          @ARTICLE{Dolezal2022-qa,
          title    = "Uncertainty-informed deep learning models enable high-confidence
                      predictions for digital histopathology",
          author   = "Dolezal, James M and Srisuwananukorn, Andrew and Karpeyev, Dmitry
                      and Ramesh, Siddhi and Kochanny, Sara and Cody, Brittany and
                      Mansfield, Aaron S and Rakshit, Sagar and Bansal, Radhika and
                      Bois, Melanie C and Bungum, Aaron O and Schulte, Jefree J and
                      Vokes, Everett E and Garassino, Marina Chiara and Husain, Aliya N
                      and Pearson, Alexander T",
          journal  = "Nature Communications",
          volume   =  13,
          number   =  1,
          pages    = "6572",
          month    =  nov,
          year     =  2022
          }
  
  # Uses
  
  ## Examples
  For direct use, the model can be loaded using Tensorflow/Keras:
  
  ```
  import tensorflow as tf
  model = tf.keras.models.load_model('/path/')
  ```
  
  or loaded with [Slideflow](https://github.com/jamesdolezal/slideflow) version 1.1+ with the following syntax:
  
  ```
  import slideflow as sf
  model = sf.model.load('/path/')
  ```
  
  The stain normalizer can be loaded and fit using Slideflow:
  
  ```
  normalizer = sf.util.get_model_normalizer('/path/')
  ```
  
  The stain normalizer has a native Tensorflow transform and can be directly applied to a tf.data.Dataset:
  
  ```
  # Map the stain normalizer transformation
  # to a tf.data.Dataset
  dataset = dataset.map(normalizer.tf_to_tf)
  ```
  
  Alternatively, the model can be used to generate predictions for whole-slide images processed through Slideflow in an end-to-end [Project](https://slideflow.dev/project_setup.html). To use the model to generate predictions on data processed with Slideflow, simply pass the model to the [`Project.predict()`](https://slideflow.dev/project.html#slideflow.Project.predict) function:
  
  ```
  import slideflow
  P = sf.Project('/path/to/slideflow/project')
  P.predict('/model/path')
  ```
  
  ## Direct Use
  This model is intended for research purposes only. Possible research areas and tasks include
  
  - Development and comparison of uncertainty quantification methods for pathologic images.
  - Probing and understanding the limitations of out-of-distribution detection for pathology classification models.
  - Applications in educational settings.
  - Research on pathology classification models for non-small cell lung cancer.
  
  Excluded uses are described below.
  
  ### Misuse and Out-of-Scope Use
  This model should not be used in a clinical setting to generate predictions that will be used to inform patients, physicians, or any other health care members directly involved in their health care outside the context of an approved research protocol. Using the model in a clinical setting outside the context of an approved research protocol is a misuse of this model. This includes, but is not limited to:
  
  - Generating predictions of images from a patient's tumor and sharing those predictions with the patient
  - Generating predictions of images from a patient's tumor and sharing those predictions with the patient's physician, or other members of the patient's healthcare team
  - Influencing a patient's health care treatment in any 