facebookresearch / SlowFast

PySlowFast: video understanding codebase from FAIR for reproducing state-of-the-art video models.
Apache License 2.0
6.62k stars 1.22k forks source link

Caffe2_checkpoint is integer when loading pre-train models #354

Open andres-ramirez27 opened 3 years ago

andres-ramirez27 commented 3 years ago

Hello. I'm testing different pre-train networks you offer on MODEL_ZOO.md. When I'm loading different model using pickle (as they are in caffe2), it returns an integer; this later results in an error as an integer doesn't have key-values.

My environment corresponds to a docker container, generated from pytorch/pytorch:1.7.0-cuda11.0-cudnn8-runtime image available in Docker Hub, running Ubuntu 18.04.5 LTS and with the needed dependencies stated in the INSTALL.md. Important dependencies version to mention:

My hardware is:

This happens specifically in the lines 213-215 from the slowfast/utils/checkpoint.py, in the load_checkpoint function.

213    if convert_from_caffe2:
214        with g_pathmgr.open(path_to_checkpoint, "rb") as f:
215            caffe2_checkpoint = pickle.load(f, encoding="latin1")

caffe2_checkpoint is an int, so when it tries access the keys from the dictionary, it fails (line 218):

218        for key in caffe2_checkpoint["blobs"].keys():

The caffe2_checkpoint is an integer for some model. Among the tested models with this behavior, are:

Other tested model that return the correct object (dictionary), are:

The command I'm using is:

python3 slowfast/tools/run_net.py \
--cfg \ 
slowfast/configs/AVA/c2/SLOWFAST_64x2_R101_50_50.yaml \
TEST.DATASET ava \
DATA.PATH_TO_DATA_DIR PATH_TO_DATA_DIR \
AVA.ANNOTATION_DIR annotations \
AVA.LABEL_MAP_FILE ava_action_list_v2.2.pbtxt \
AVA.GROUNDTRUTH_FILE ava_val_v2.2.csv \
AVA.EXCLUSION_FILE ava_val_excluded_timestamps_v2.2.csv \
AVA.TEST_PREDICT_BOX_LISTS [' "ava_val_predicted_boxes.csv" ']
AVA.FRAME_DIR frames \
AVA.FRAME_LIST_DIR frame_lists \
AVA.TEST_LISTS [' "val.csv" '] \
TEST.CHECKPOINT_FILE_PATH path/to/SLOWFAST_64x2_R101_50_50.pkl \
TEST.CHECKPOINT_TYPE caffe2
TRAIN.ENABLE False \
TEST.ENABLE True \
DATA.NUM_FRAMES 16 \
NUM_GPUS 1

I would like to confirm if the problem is only on my end or the .pkl files have the problem.

YaoFANGUK commented 3 years ago

I encountered the same problem when i use model of 'SLOWFAST_64x2_R101_50_50.pkl'. for key in caffe2_checkpoint["blobs"].keys(): TypeError: 'int' object is not subscriptable

exnx commented 3 years ago

I had the same problems, see this post:

https://github.com/facebookresearch/SlowFast/issues/85

huang-chenhai commented 2 years ago

I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same.

coldmanck commented 2 years ago

I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same.

Do you mean they accidentally put the pretrained model weights as trained weights, and vice versa? If yes, It's ridiculous that until now (January 2022) it's still not been fixed! It's un-FAIR...

kuangxiaoye commented 2 years ago

I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same.

https://dl.fbaipublicfiles.com/pyslowfast/model_zoo/ava/pretrain/SLOWFAST_32x2_R101_50_50.pkl

你救了我的命哈哈哈哈哈哈哈

裂开了 他这里怎么搞的这么混淆

huang-chenhai commented 2 years ago

怎么感觉看这个的都是中国人,中国人用英语交流,可太逗了

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年3月22日(星期二) 晚上9:47 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [facebookresearch/SlowFast] Caffe2_checkpoint is integer when loading pre-train models (#354)

I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same.

https://dl.fbaipublicfiles.com/pyslowfast/model_zoo/ava/pretrain/SLOWFAST_32x2_R101_50_50.pkl

你救了我的命哈哈哈哈哈哈哈

裂开了 他这里怎么搞的这么混淆

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

kuangxiaoye commented 2 years ago

怎么感觉看这个的都是中国人,中国人用英语交流,可太逗了 ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年3月22日(星期二) 晚上9:47 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [facebookresearch/SlowFast] Caffe2_checkpoint is integer when loading pre-train models (#354) I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same. https://dl.fbaipublicfiles.com/pyslowfast/model_zoo/ava/pretrain/SLOWFAST_32x2_R101_50_50.pkl 你救了我的命哈哈哈哈哈哈哈 裂开了 他这里怎么搞的这么混淆 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

哈哈哈哈哈本来就都是中国人

然后我看你们都用英文哈哈哈哈

笑死我了

我每次都直接打中文 然后原地把整栋楼都炸成红的 全是中国人哈哈哈哈

EiEM233 commented 2 years ago

怎么感觉看这个的都是中国人,中国人用英语交流,可太逗了 ------------------ 原始邮件 ------------------ 发件人: @.**>; 发送时间: 2022年3月22日(星期二) 晚上9:47 收件人: @.**>; 抄送: @.**>; @.**>; 主题: Re: [facebookresearch/SlowFast] Caffe2_checkpoint is integer when loading pre-train models (#354) I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same. https://dl.fbaipublicfiles.com/pyslowfast/model_zoo/ava/pretrain/SLOWFAST_32x2_R101_50_50.pkl 你救了我的命哈哈哈哈哈哈哈 裂开了 他这里怎么搞的这么混淆 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

哈哈哈哈哈本来就都是中国人

然后我看你们都用英文哈哈哈哈

笑死我了

我每次都直接打中文 然后原地把整栋楼都炸成红的 全是中国人哈哈哈哈

别说了,我也遇到这个bug了,哈哈哈哈哈哈

geyaping commented 2 years ago

怎么感觉看这个的都是中国人,中国人用英语交流,可太逗了 ------------------ 原始邮件 ------------------ 发件人: @.**>; 发送时间: 2022年3月22日(星期二) 晚上9:47 收件人: @.**>; 抄送: @.**>; @.**>; 主题: Re: [facebookresearch/SlowFast] Caffe2_checkpoint is integer when loading pre-train models (#354) I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same. https://dl.fbaipublicfiles.com/pyslowfast/model_zoo/ava/pretrain/SLOWFAST_32x2_R101_50_50.pkl 你救了我的命哈哈哈哈哈哈哈 裂开了 他这里怎么搞的这么混淆 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

哈哈哈哈哈本来就都是中国人 然后我看你们都用英文哈哈哈哈 笑死我了 我每次都直接打中文 然后原地把整栋楼都炸成红的 全是中国人哈哈哈哈

别说了,我也遇到这个bug了,哈哈哈哈哈哈

me too,哈哈哈哈哈

3210448723 commented 10 months ago

哈哈,纯小白,我看的这个视频讲解,但是也遇到了同样问题