文章目录
代码流程
预处理preprocessing.py
训练中期融合模型fusion_pretrain,py
提取特征中期融合并决策main.py
训练中期融合模型fusion_pretrain.py
fusion_pretrain,py
调用engine_fusion_pretrain.py中的train_one_epoch
for data_iter_step,(samples,-) in enumerate (...)
xyz_samples=samples[:,:,:,1152].to(device,...)
rgb_samples=samples[:,:,1152,:].to(device,...)
scores=
...
loss.value=loss.item()
loss_scaler(...)
提取特征中期融合并决策main.py
features.py中的
class Features(torch.nn.module)
...
def __init__
...
self.deep_feature_extractor=Model(device=,rgb_backbonename=,xyz_b...,group_size=,num_group...)
self.fusion=FeatureFusionBlock(1152,768,...)
self.detect_fuser=linear_model.SGDOneClassSVM(...)
def intepolate_point(self,rgb,xyz)
...
return xyz_feature_maps,center,xyz
def compute_s_s_map
def calculate_metrics(self):
...
...roc_auc_score(self.image_labels,self.image_preds)
...calculate_au_pro(self.gts,self.predic)
m3dm.runner.py中的
def fit (self.class_name):
for sample,_ in tqdm(train_loader,desc=f'extracting...')
method.add_sample_to_mem_bank(sample)
...
method.run_late_fusion()
...
with torch.no_grad():
for sample,mask,label,rgb_patch in tqdm(test_loader,desc=f'extracting...')
for method in self.methods.values():
method.predict(sample,mask,label)
...
标签:M3DM,...,代码,py,pretrain,fusion,阅读,xyz,self
From: https://blog.csdn.net/tfxzgp/article/details/139776082