Code for Paper Predicting Osteoarthritis Progression via Unsupervised Adversarial Representation Learning

Overview

Predicting Osteoarthritis Progression via Unsupervised Adversarial Representation Learning

(c) Tianyu Han and Daniel Truhn, RWTH Aachen University, 2021

About

What's included in this Repo

The repository includes the codes for data / label preparation and inferencing the future knee radiograph, training and testing the baseline classifier and also the links to the pre-trained generative model.

Focus of the current work

Osteoarthritis (OA) is the most common joint disorder in the world affecting 10% of men and 18% of women over 60 years of age. In this paper, we present an unsupervised learning scheme to predict the future image appearance of patients at recurring visits.

By exploring the latent temporal trajectory based on knee radiographs, our system predicts the risk of accelerated progression towards OA and surpasses its supervised counterpart. We demonstrate this paradigm with seven radiologists who were tasked to predict which patients will undergo a rapid progression.

Requirements

pytorch 1.8.1
tensorboard 2.5.0
numpy 1.20.3
scipy 1.6.2
scikit-image 0.18.1
pandas
tqdm
glob
pickle5
  • StyleGAN2-ADA-Pytorch
    This repository is an official reimplementation of StyleGAN2-ADA in PyTorch, focusing on correctness, performance, and compatibility.
  • KNEE Localization
    The repository includes the codes for training and testing, annotations for the OAI dataset and also the links to the pre-trained models.
  • Robust ResNet classifier
    The repository contains codes for developing robust ResNet classifier with a superior performance and interpretability.

How to predict the future state of a knee

Preparing the training data and labels

Download all available OAI and MOST images from https://nda.nih.gov/oai/ and https://most.ucsf.edu/. The access to the images is free and painless. You just need to register and provide the information about yourself and agree with the terms of data use. Besides, please also download the label files named Semi-Quant_Scoring_SAS and MOSTV01235XRAY.txt from OAI and MOST, separately.

Following the repo of KNEE Localization, we utilized a pre-trained Hourglass network and extracted 52,981 and 20,158 (separated left or right) knee ROI (256x256) radiographs from both OAI and MOST datasets. We further extract the semi-quantitative assessment Kellgren-Lawrence Score (KLS) from the labels files above. To better relate imaging and tabular data together, in OAI dataset, we name the knee radiographs using ID_BARCDBU_DATE_SIDE.png, e.g., 9927360_02160601_20070629_l.png. For instance, to generate the KLS label file (most.csv) of the MOST dataset, one can run:

python kls.py

Training a StyleGAN2 model on radiological data

Follow the official repo StyleGAN2, datasets are stored as uncompressed ZIP archives containing uncompressed PNG files. Our datasets can be created from a folder containing radiograph images; see python dataset_tool.py --help for more information. In the auto configuration, training a OAI GAN boils down to:

python train.py --outdir=~/training-runs --data=~/OAI_data.zip --gpus=2

The total training time on 2 Titan RTX cards with a resolution of 256x256 takes around 4 days to finish. The best GAN model of our experiment can be downloaded at here.

Projecting training radiographs to latent space

To find the matching latent vector for a given training set, run:

python projector.py --outdir=~/pro_out --target=~/training_set/ --network=checkpoint.pkl

The function multi_projection() within the script will generate a dictionary contains pairs of image name and its corresponding latent code and individual projection folders.

Synthesize future radiograph

  • require: A pre-trained network G, test dataframe path (contains test file names), and individual projection folders (OAI training set). To predict the baseline radiographs within the test dataframe, just run:
python prog_w.py --network=checkpoint.pkl --frame=test.csv --pfolder=~/pro_out/ 

Estimating the risk of OA progression

In this study, we have the ability to predict the morphological appearance of the radiograph at a future time point and compute the risk based on the above synthesized state. We used an adversarially trained ResNet model that can correctly classify the KLS of the input knee radiograph.

To generate the ROC curve of our model, run:

python risk.py --ytrue=~/y_true.npy --ystd=~/baseline/pred/y_pred.npy --ybase=~/kls_cls/pred/ypred.npy --yfinal=~/kls_cls/pred/ypred_.npy --df=~/oai.csv

Baseline classifier

To compare what is achievable with supervised learning based on the existing dataset, we finetune a ResNet-50 classifier pretrained on ImageNet that tries to distinguish fast progressors based on baseline radiographs in a supervised end-to-end manner. The output probability of such a classifier is based on baseline radiographs only. To train the classifier, after putting the label files to the base_classifier/label folder, one can run:

cd base_classifier/
python train.py --todo train --data_root ../Xray/dataset_oai/imgs/ --affix std --pretrain True --batch_size 32

To test, just run:

cd base_classifier/
python train.py --todo test --data_root ../Xray/dataset_oai/imgs/ --batch_size 1

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Citation

@misc{han2021predicting,
      title={Predicting Osteoarthritis Progression in Radiographs via Unsupervised Representation Learning}, 
      author={Tianyu Han and Jakob Nikolas Kather and Federico Pedersoli and Markus Zimmermann and Sebastian Keil and Maximilian Schulze-Hagen and Marc Terwoelbeck and Peter Isfort and Christoph Haarburger and Fabian Kiessling and Volkmar Schulz and Christiane Kuhl and Sven Nebelung and Daniel Truhn},
      year={2021},
      eprint={2111.11439},
      archivePrefix={arXiv},
      primaryClass={eess.IV}
}

Acknowledgments

You might also like...
This repo is a PyTorch implementation for Paper
This repo is a PyTorch implementation for Paper "Unsupervised Learning for Cuboid Shape Abstraction via Joint Segmentation from Point Clouds"

Unsupervised Learning for Cuboid Shape Abstraction via Joint Segmentation from Point Clouds This repository is a PyTorch implementation for paper: Uns

Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

Propagate Yourself: Exploring Pixel-Level Consistency for Unsupervised Visual Representation Learning, CVPR 2021
Propagate Yourself: Exploring Pixel-Level Consistency for Unsupervised Visual Representation Learning, CVPR 2021

Propagate Yourself: Exploring Pixel-Level Consistency for Unsupervised Visual Representation Learning By Zhenda Xie*, Yutong Lin*, Zheng Zhang, Yue Ca

[CVPR 2021] Unsupervised Degradation Representation Learning for Blind Super-Resolution
[CVPR 2021] Unsupervised Degradation Representation Learning for Blind Super-Resolution

DASR Pytorch implementation of "Unsupervised Degradation Representation Learning for Blind Super-Resolution", CVPR 2021 [arXiv] Overview Requirements

UniMoCo: Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning
UniMoCo: Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning

UniMoCo: Unsupervised, Semi-Supervised and Full-Supervised Visual Representation Learning This is the official PyTorch implementation for UniMoCo pape

[NeurIPS 2021] ORL: Unsupervised Object-Level Representation Learning from Scene Images
[NeurIPS 2021] ORL: Unsupervised Object-Level Representation Learning from Scene Images

Unsupervised Object-Level Representation Learning from Scene Images This repository contains the official PyTorch implementation of the ORL algorithm

An official PyTorch implementation of the TKDE paper "Self-Supervised Graph Representation Learning via Topology Transformations".

Self-Supervised Graph Representation Learning via Topology Transformations This repository is the official PyTorch implementation of the following pap

A PyTorch implementation of the paper
A PyTorch implementation of the paper "Semantic Image Synthesis via Adversarial Learning" in ICCV 2017

Semantic Image Synthesis via Adversarial Learning This is a PyTorch implementation of the paper Semantic Image Synthesis via Adversarial Learning. Req

Implementation based on Paper - Learning a Probabilistic Latent Space of Object Shapes via 3D Generative-Adversarial Modeling

Implementation based on Paper - Learning a Probabilistic Latent Space of Object Shapes via 3D Generative-Adversarial Modeling

Releases(v1.0)
Owner
Tianyu Han
Tianyu Han
This repository contains the code used for Predicting Patient Outcomes with Graph Representation Learning (https://arxiv.org/abs/2101.03940).

Predicting Patient Outcomes with Graph Representation Learning This repository contains the code used for Predicting Patient Outcomes with Graph Repre

Emma Rocheteau 76 Dec 22, 2022
code for paper "Does Unsupervised Architecture Representation Learning Help Neural Architecture Search?"

Does Unsupervised Architecture Representation Learning Help Neural Architecture Search? Code for paper: Does Unsupervised Architecture Representation

null 39 Dec 17, 2022
This is the code for CVPR 2021 oral paper: Jigsaw Clustering for Unsupervised Visual Representation Learning

JigsawClustering Jigsaw Clustering for Unsupervised Visual Representation Learning Pengguang Chen, Shu Liu, Jiaya Jia Introduction This project provid

DV Lab 73 Sep 18, 2022
[AAAI2021] The source code for our paper 《Enhancing Unsupervised Video Representation Learning by Decoupling the Scene and the Motion》.

DSM The source code for paper Enhancing Unsupervised Video Representation Learning by Decoupling the Scene and the Motion Project Website; Datasets li

Jinpeng Wang 114 Oct 16, 2022
This is an implementation for the CVPR2020 paper "Learning Invariant Representation for Unsupervised Image Restoration"

Learning Invariant Representation for Unsupervised Image Restoration (CVPR 2020) Introduction This is an implementation for the paper "Learning Invari

GarField 88 Nov 7, 2022
This is the official pytorch implementation for the paper: Instance Similarity Learning for Unsupervised Feature Representation.

ISL This is the official pytorch implementation for the paper: Instance Similarity Learning for Unsupervised Feature Representation, which is accepted

null 19 May 4, 2022
Code for the paper: Adversarial Training Against Location-Optimized Adversarial Patches. ECCV-W 2020.

Adversarial Training Against Location-Optimized Adversarial Patches arXiv | Paper | Code | Video | Slides Code for the paper: Sukrut Rao, David Stutz,

Sukrut Rao 32 Dec 13, 2022
Viewmaker Networks: Learning Views for Unsupervised Representation Learning

Viewmaker Networks: Learning Views for Unsupervised Representation Learning Alex Tamkin, Mike Wu, and Noah Goodman Paper link: https://arxiv.org/abs/2

Alex Tamkin 31 Dec 1, 2022
CRLT: A Unified Contrastive Learning Toolkit for Unsupervised Text Representation Learning

CRLT: A Unified Contrastive Learning Toolkit for Unsupervised Text Representation Learning This repository contains the code and relevant instructions

XiaoMing 5 Aug 19, 2022
Official PyTorch code for WACV 2022 paper "CFLOW-AD: Real-Time Unsupervised Anomaly Detection with Localization via Conditional Normalizing Flows"

CFLOW-AD: Real-Time Unsupervised Anomaly Detection with Localization via Conditional Normalizing Flows WACV 2022 preprint:https://arxiv.org/abs/2107.1

Denis 156 Dec 28, 2022