The code for the paper entitled Transformer-based Deep Learning Prediction of 10-Degree Humphrey Visual Field Tests from 24-Degree Data. If you have any questions, please email harvardophai@gmail.com and harvardairobotics@gmail.com.
Python 3.8
tensorflow 2.4.0
opencv-python 4.5.5
Here are sample codes to visualize the source 24-2 VF map:
import tensorflow as tf
from vf_tools import *
import pandas as pd
vfdata = np.load('data/vfdata.npy', allow_pickle=True)
age, righteye, duration, centralval, centralprob, md, mdprob, psd, timegap, tds = vfdata[1]
plot_vf(tds)
Download the model via this link. Unzip the file and put under the "checkpoint" folder.
Please refer to example.ipynb.
# prepare the data
test_dataset, tds24_test = prepare_data(vfdata)
# load the pretrained model
model = tf.keras.models.load_model('checkpoint/fttransformer')
# predict 10-2 VF
preds = model.predict((test_dataset, tds24_test))
vf10_pred = np.array(preds['output'])
# visualize the source 24-2 VF and predicted 10-2 VF
plot_vf(tds24_test[1], title='source 24-2 VF')
plot_vf(vf10_pred[1], title='predicted 10-2 VF')
Coming soon ...