4.4.4 Saliency - WangLabTHU/GPro GitHub Wiki

hcwang and qxdu edited on Aug 4, 2023, 1 version

Introduction

Saliency Map is an important concept of deep learning and Computer vision. While training sequences of DNA, how does predictor model knows to focus on high-expresssion position and ignore the flanking sequences and the other background noise in the sequences? By using the concept of Saliency Map.

Parameters

Caution: Note that the format of the sequence and expression files here should be consistent with the QuickStart section.

params description default value
predictor the trained predictor class
predictor_modelpath the pretrained model checkpoint, should be "x/xxx.pth" format
predictor_training_datapath path of natural sequences, training set for predictor will be the best
predictor_expression_datapath path of corresponding expression level with predictor_seqpath
report_path saving folder
file_tag saving name
num_seqs_to_test sampling scales for frequency comparison 200

Demo

from gpro.evaluator.saliency import plot_saliency_map

project_path = "your project path"
predictor_training_datapath = os.path.join(project_path,'data/diffusion_promoter/sequence_data.txt')

from gpro.predictor.densenet.densenet import DenseNet_language
predictor = DenseNet_language(length=50)
predictor_modelpath = os.path.join(project_path, 'checkpoints/densenet/' + 'checkpoint.pth')

plot_saliency_map(predictor, predictor_training_datapath, predictor_modelpath, 
                      report_path="./results/", file_tag="DenseNet")

The final result will be saved in the ./results directory.

⚠️ **GitHub.com Fallback** ⚠️