ekosman/AnomalyDetectionCVPR2018-Pytorch

TrainingAnomalyDetector_public.py Error. Help Me

Closed this issue · 1 comments

Getting below error when running TrainingAnomalyDetector_public.py.

File "TrainingAnomalyDetector_public.py", line 96, in
save_every=20000)
File "C:\AnomalyDetectionCVPR2018-Pytorch-master\network\TorchUtils.py", line 118, in fit
epoch=epoch)
File "C:\AnomalyDetectionCVPR2018-Pytorch-master\network\TorchUtils.py", line 177, in do_epoch
batch = self.data_to_device(batch, self.device)
File "C:\AnomalyDetectionCVPR2018-Pytorch-master\network\TorchUtils.py", line 219, in data_to_device
data = data.to(device)
AttributeError: 'str' object has no attribute 'to'

command
python TrainingAnomalyDetector_public.py --features_path anomaly_features --annotation_path Train_Annotation.txt

anomaly_features=> Directory having pre-computed features downloaded from https://drive.google.com/drive/folders/1rhOuAdUqyJU4hXIhToUnh5XVvYjQiN50?usp=sharing

In line 162 of the features_loader.py file, you need to replace return {'input': item[0], 'target': item[1]}
with return (item[0], item[1]). Hope this helps.