This is the repository associated with the paper "3BTRON: A Blood-Brain Barrier Recognition Network".
Here, we provide a description of the files made available in this repository.
To promote the sharing of resources, we provide the trained model described in the paper, optimised for the PyTorch framework (3BTRON.pt).
This folder contains all associated code (including scripts for data pre-processing, training and evaluation, stratification and for generating and visualising GradCAM heatmaps).
The data presented in this study can be found on Zenodo at: https://doi.org/10.5281/zenodo.14845497.
Code for experiments and figures presented in this study will be made available by the corresponding author upon reasonable request.
For this, you will need to have conda installed (find more information here: https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html)
Create the environment from the environment.yml file:
conda env create -f environment.yml
Activate the environment:
conda activate img-classification
Verify that the environment was installed correctly:
conda env list
To generate outputs on your own data, you will first need to load the model before setting the model to evaluation mode:
from torchvision import models
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
resnet50 = models.resnet50(weights='DEFAULT')
model = mixedresnetnetwork(model=resnet50, embeddings=resnet50.fc.in_features)
SAVE_END_MODEL=True
if SAVE_END_MODEL:
model.load_state_dict(torch.load('./3BTRON.pt'))
model = model.to(device)
model.eval()
Alternatively, you can run the python scripts 'generate_outputs_labelled.py' for labelled data or 'generate_outputs_unlabelled.py' for unlabelled data.
To fine-tune the model on your own data, you will need to set the model to training mode using:
model.train()
To adapt the model to your own data, you will need to retrain the model from scratch.
This code in maintained by Nan Fletcher-Lloyd.