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
Getting nan prediction in demo_net.py with AVA on custom video #241
Comments
Hey @Serhii-Tiurin, |
i got the same problem |
Hi, Thanks, |
same issue here. |
Thank you for bringing this issue to our attention. I cannot reproduce the issue using my local environment, so I suspect this is an environment-dependent problem. My environment is: What are @Serhii-Tiurin Do you mind sharing me your input video? I would like to test with it as well to make sure we are running |
Thanks for your attention.
... |
after some debugging, maybe i could fix this issue. frames are preprocessed by after so add divide by 255 after scale could fix this issue. |
@irvingzhang0512 yes, you fixed the issue. Thanks. |
by default, we get person bbox from the FYI, by default, demo_net.py predicts action labels every so if you want to get the "good" visualizing results, try to
However, this demo runs extramely slow... |
Thanks for your reply. |
Thanks all of you guys! |
@irvingzhang0512 thanks for update regarding object bboxes. Is there an option to make object bboxes every frame and action recognition on sequence of frames? |
Code has changed ? There is no L293 |
This still seems to happen, however the solution proposed above by @irvingzhang0512 is no longer valid due to: SlowFast/slowfast/visualization/utils.py Line 313 in fd41618
It would be good to get some feedback from the authors on this. Adding in the line proposed by @irvingzhang0512 does cause the input to be non nan however the prediction accuracy drops off (using a custom trained model using the AVA process). This is becouse if we divide the images by 255, the |
Adding /255 to the images twice in the training and inference script (as per @irvingzhang0512) seems to be a workaround that works reasonably well: |
When running python tools/run_net.py --cfg /home/ubuntu/slowfast/configs/AVA/c2/SLOWFAST_32x2_R101_50_50.yaml i am getting nan predictions in https://github.com/facebookresearch/SlowFast/blob/master/tools/demo_net.py#L242
Python version - 3.6.10 (on 3.7.7 didnt work too)
Pytorch - 1.5.1
Torchvision - 0.6.1
Cuda - 10.0
Detectron2 - 0.2
Here is config:
TRAIN:
ENABLE: False
DATASET: ava
BATCH_SIZE: 16
EVAL_PERIOD: 1
CHECKPOINT_PERIOD: 1
AUTO_RESUME: True
CHECKPOINT_FILE_PATH: "/home/ubuntu/SLOWFAST_32x2_R101_50_50.pkl"
CHECKPOINT_TYPE: pytorch
DATA:
NUM_FRAMES: 32
SAMPLING_RATE: 2
TRAIN_JITTER_SCALES: [256, 320]
TRAIN_CROP_SIZE: 224
TEST_CROP_SIZE: 256
INPUT_CHANNEL_NUM: [3, 3]
DETECTION:
ENABLE: True
ALIGNED: False
AVA:
BGR: False
DETECTION_SCORE_THRESH: 0.8
TEST_PREDICT_BOX_LISTS: ["person_box_67091280_iou90/ava_detection_val_boxes_and_labels.csv"]
SLOWFAST:
ALPHA: 4
BETA_INV: 8
FUSION_CONV_CHANNEL_RATIO: 2
FUSION_KERNEL_SZ: 5
RESNET:
ZERO_INIT_FINAL_BN: True
WIDTH_PER_GROUP: 64
NUM_GROUPS: 1
DEPTH: 101
TRANS_FUNC: bottleneck_transform
STRIDE_1X1: False
NUM_BLOCK_TEMP_KERNEL: [[3, 3], [4, 4], [6, 6], [3, 3]]
SPATIAL_DILATIONS: [[1, 1], [1, 1], [1, 1], [2, 2]]
SPATIAL_STRIDES: [[1, 1], [2, 2], [2, 2], [1, 1]]
NONLOCAL:
LOCATION: [[[], []], [[], []], [[6, 13, 20], []], [[], []]]
GROUP: [[1, 1], [1, 1], [1, 1], [1, 1]]
INSTANTIATION: dot_product
POOL: [[[2, 2, 2], [2, 2, 2]], [[2, 2, 2], [2, 2, 2]], [[2, 2, 2], [2, 2, 2]], [[2, 2, 2], [2, 2, 2]]]
BN:
USE_PRECISE_STATS: False
NUM_BATCHES_PRECISE: 200
SOLVER:
MOMENTUM: 0.9
WEIGHT_DECAY: 1e-7
OPTIMIZING_METHOD: sgd
MODEL:
NUM_CLASSES: 80
ARCH: slowfast
MODEL_NAME: SlowFast
LOSS_FUNC: bce
DROPOUT_RATE: 0.5
HEAD_ACT: sigmoid
TEST:
ENABLE: False
DATASET: ava
BATCH_SIZE: 8
DATA_LOADER:
NUM_WORKERS: 2
PIN_MEMORY: True
DEMO:
ENABLE: True
LABEL_FILE_PATH: "./demo/AVA/ava.names"
DATA_SOURCE: "/home/ubuntu/gestures_dataset_right_wave_15.mp4"
DISPLAY_WIDTH: 640
DISPLAY_HEIGHT: 480
DETECTRON2_OBJECT_DETECTION_MODEL_CFG: "COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml"
DETECTRON2_OBJECT_DETECTION_MODEL_WEIGHTS: "detectron2://COCO-Detection/faster_rcnn_R_50_FPN_3x/137849458/model_final_280758.pkl"
NUM_GPUS: 1
NUM_SHARDS: 1
RNG_SEED: 0
OUTPUT_DIR: .
And here is part of logs:
/home/ubuntu/slowfast/slowfast/models/head_helper.py:111: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert out.shape[2] == 1
/home/ubuntu/detectron2_repo/detectron2/layers/roi_align.py:105: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert rois.dim() == 2 and rois.size(1) == 5
/home/ubuntu/slowfast/slowfast/models/head_helper.py:111: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert out.shape[2] == 1
/home/ubuntu/detectron2_repo/detectron2/layers/roi_align.py:105: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert rois.dim() == 2 and rois.size(1) == 5
[WARNING: flop_count.py: 63]: Skipped operation aten::batch_norm 215 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::batch_norm 215 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::relu_ 204 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::relu_ 204 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::max_pool3d 7 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::max_pool3d 7 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::add 69 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::add 69 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::div 3 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::div 3 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::avg_pool3d 2 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::avg_pool3d 2 time(s)
[WARNING: flop_count.py: 63]: Skipped operation prim::PythonOp 2 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation prim::PythonOp 2 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::max_pool2d 2 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::max_pool2d 2 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::dropout 1 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::dropout 1 time(s)
[WARNING: flop_count.py: 63]: Skipped operation aten::sigmoid 1 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.flop_count: 63: Skipped operation aten::sigmoid 1 time(s)
[INFO: misc.py: 160]: Flops: 146.54916608 G
[07/11 21:40:19][INFO] slowfast.utils.misc: 160: Flops: 146.54916608 G
[WARNING: activation_count.py: 54]: Skipped operation aten::batch_norm 215 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::batch_norm 215 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::relu_ 204 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::relu_ 204 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::max_pool3d 7 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::max_pool3d 7 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::add 69 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::add 69 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::einsum 6 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::einsum 6 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::div 3 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::div 3 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::avg_pool3d 2 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::avg_pool3d 2 time(s)
[WARNING: activation_count.py: 54]: Skipped operation prim::PythonOp 2 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation prim::PythonOp 2 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::max_pool2d 2 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::max_pool2d 2 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::dropout 1 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::dropout 1 time(s)
[WARNING: activation_count.py: 54]: Skipped operation aten::sigmoid 1 time(s)
[07/11 21:40:19][WARNING] fvcore.nn.activation_count: 54: Skipped operation aten::sigmoid 1 time(s)
[INFO: misc.py: 165]: Activations: 293.60136 M
[07/11 21:40:19][INFO] slowfast.utils.misc: 165: Activations: 293.60136 M
[INFO: misc.py: 168]: nvidia-smi
[07/11 21:40:19][INFO] slowfast.utils.misc: 168: nvidia-smi
Please feel free to ask any additional information if needed.
The text was updated successfully, but these errors were encountered: