-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
found some bugs #5
Comments
@zuiwomeirenxi would you mind posting your sequence of steps for training the models in this project? It's a little be difficult understanding the protocol. |
Today is the Lunar New Year, and I'm on vacation. Can I reply to you after my vacation is over? |
@zuiwomeirenxi yes, of course! Enjoy your vacation! |
@zuiwomeirenxi just pinging you again for any suggestions. Thanks, |
Hello Marc, although my modified code can run now, during the program execution, besides the reduction in loss, none of the metrics such as accuracy, AUC, precision, and F1 score have changed. They remain fixed at 60, 0.5, 5.7, and 0.099 respectively. |
My programming skills are poor. If you have any questions, feel free to ask me, and I'll do my best to answer. If you could improve the code, I'd appreciate it if you could share it with me. Thank you! |
@zuiwomeirenxi can you tell me the steps that you used actually run it? |
First, you need to extract features. The code provided by the authors can extract features, but running the model proposed by the authors is not feasible. The model provided by the authors itself is flawed. |
@zuiwomeirenxi ok thanks. It is unfortunately not worth my time to spend anymore time trying to figure out this code base. Especially since you could not replicate the paper's performance after your own efforts. |
The first error:
Traceback (most recent call last):
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 371, in
main()
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 367, in main
main_objective(config, args)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 110, in main_objective
train_set = feature_dataset.ClipDataset(
TypeError: ClipDataset.init() got an unexpected keyword argument 'normals'
The second error occurred when I commented out 'normals=False':
Traceback (most recent call last):
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 371, in
main()
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 367, in main
main_objective(config, args)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 128, in main_objective
feat, label = train_set[0]
ValueError: too many values to unpack (expected 2)
I modified 'feat, label = train_set[0]' to 'feat, label,, = train_set[0]' which led to the third error:
Traceback (most recent call last):
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 371, in
main()
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 367, in main
main_objective(config, args)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 149, in main_objective
gcl_model = K.models.GCLModel(
AttributeError: module 'k_diffusion.models' has no attribute 'GCLModel'. Did you mean: 'GVADModel'?
So, I changed
gcl_model = K.models.GCLModel(
feat_size,
)
to
gcl_model = K.models.GVADModel(
feat_size,
)
Continuing, I encountered the fourth error:
Traceback (most recent call last):
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 371, in
main()
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 367, in main
main_objective(config, args)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 282, in main_objective
evaluate()
File "D:\anaconda\envs\diffuser\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\anaconda\envs\diffuser\lib\contextlib.py", line 79, in inner
return func(*args, **kwds)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 258, in evaluate
gen_preds, labels, _, _ = K.evaluation.compute_eval_outs_aot(accelerator, sample_fn, test_dl)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\k_diffusion\evaluation.py", line 21, in compute_eval_outs_aot
feat = batch['data']
TypeError: list indices must be integers or slices, not str
Then, I changed:
feat = batch['data']
y = batch['label']
vid = batch['vid_id']
i = batch['idx']
to:
feat = batch[0]
y = batch[1]
vid = batch[2]
i = batch[3]
Which resulted in the fifth error:
Traceback (most recent call last):
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 371, in
main()
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 367, in main
main_objective(config, args)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 282, in main_objective
evaluate()
File "D:\anaconda\envs\diffuser\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\anaconda\envs\diffuser\lib\contextlib.py", line 79, in inner
return func(*args, **kwds)
File "C:\DOWNLOAD\video_anomaly_diffusion-main\video_anomaly_diffusion-main\train_ano.py", line 261, in evaluate
preds_auc = auroc(gen_preds, labels,task="binary")
File "D:\anaconda\envs\diffuser\lib\site-packages\torchmetrics\functional\classification\auroc.py", line 470, in auroc
return binary_auroc(preds, target, max_fpr, thresholds, ignore_index, validate_args)
File "D:\anaconda\envs\diffuser\lib\site-packages\torchmetrics\functional\classification\auroc.py", line 174, in binary_auroc
_binary_precision_recall_curve_tensor_validation(preds, target, ignore_index)
File "D:\anaconda\envs\diffuser\lib\site-packages\torchmetrics\functional\classification\precision_recall_curve.py", line 135, in _binary_precision_recall_curve_tensor_validation
_check_same_shape(preds, target)
File "D:\anaconda\envs\diffuser\lib\site-packages\torchmetrics\utilities\checks.py", line 42, in _check_same_shape
raise RuntimeError(
RuntimeError: Predictions and targets are expected to have the same shape, but got torch.Size([138244, 512]) and torch.Size([138244]).
I tried to recursively resolve these errors and ran this project on shanghaitech. The accuracy is around 0.79, but the AUC value remains around 0.5. This might be due to the changes I made in the code. So, I hope you could further improve the code. Your help is greatly appreciated. If you could refine the code, I would be extremely grateful."
The text was updated successfully, but these errors were encountered: