ZitongYu / CDCN

Central Difference Convolutional Networks (CVPR'20)
Other
553 stars 179 forks source link

关于REPLAY训练,CASIA测试的跨库实验 #20

Closed lz28lz28 closed 2 years ago

lz28lz28 commented 4 years ago

您好,感谢您开源工作代码,我使用CDCN这个模型进行跨库实验,得到如下的结果(casia的real人脸大部分都判定为fake), TP: 7 TN: 196 FP: 74 FN: 83 Accuracy: 0.5638888888888889 FAR: 0.2740740740740741 FRR: 0.9222222222222223 HTER: 0.5981481481481482 HTER与论文差距较大,想问下您当时有遇到这种问题吗,如果有的话是如何解决的。第二个问题是请问您训练模型时,是在loss最小时保存模型,还是在什么时候保存模型?十分感谢,期待您的回复!

silvercherry commented 4 years ago

想问一下,您在做这个两个跨集实验的实验的时候,使用到了全集还是train的文件,如果可以的话,可以细致交流吗?我的邮箱g20198868@xs.ustb.edu.cn

lz28lz28 commented 4 years ago

想问一下,您在做这个两个跨集实验的实验的时候,使用到了全集还是train的文件,如果可以的话,可以细致交流吗?我的邮箱g20198868@xs.ustb.edu.cn

您好,我跨库训练时使用的是train文件,测试用各自的test

silvercherry commented 4 years ago

想问一下,您在做这个两个跨集实验的实验的时候,使用到了全集还是train的文件,如果可以的话,可以细致交流吗?我的邮箱g20198868@xs.ustb.edu.cn

您好,我跨库训练时使用的是train文件,测试用各自的test

当我用全集进行训练的时候 使用CDCN其中一个可以达到33,论文是32.6的结果,但是另一个差的很远,您能留个邮箱吗 方便交流

lz28lz28 commented 4 years ago

想问一下,您在做这个两个跨集实验的实验的时候,使用到了全集还是train的文件,如果可以的话,可以细致交流吗?我的邮箱g20198868@xs.ustb.edu.cn

您好,我跨库训练时使用的是train文件,测试用各自的test

当我用全集进行训练的时候 使用CDCN其中一个可以达到33,论文是32.6的结果,但是另一个差的很远,您能留个邮箱吗 方便交流

您好,1030615223@vip.jiangnan.edu.cn这是我的邮箱,我也有些想和你交流交流

punitha-valli commented 4 years ago

@lz28lz28 @ZitongYu @silvercherry

can you please explain to me about the map_dir, and the oulu_npu dataset has video, but as per the source code Train-images, Dev_images, Test_images are required. Can you please explain it to me?

I am also a student, so it will be greatly helpful for me to do my research work.

can you please communicate with me, I tried a lot of ways to communicate with the author

thanks in advance

lz28lz28 commented 4 years ago

@lz28lz28 @ZitongYu @silvercherry

can you please explain to me about the map_dir, and the oulu_npu dataset has video, but as per the source code Train-images, Dev_images, Test_images are required. Can you please explain it to me?

I am also a student, so it will be greatly helpful for me to do my research work.

can you please communicate with me, I tried a lot of ways to communicate with the author

thanks in advance

map dir就是存放图片的路径吧。oulu数据集是视频,自己要处理成图片的,每个视频进行帧提取

punitha-valli commented 4 years ago

Thank you so much, I am really happy about your replay. So there is no need to pre-process the OULU dataset, can I directly feed into the code?

train_image_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/Train_images/' val_image_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/Dev_images/' test_image_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/Test_images/' map_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/IJCB_re/OULUtrain_images/' val_map_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/IJCB_re/OULUdev_images/' test_map_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/IJCB_re/OULUtest_images/' train_list = '/wrk/yuzitong/DONOTREMOVE/OULU/OULU_Protocols/Protocol_1/Train.txt' val_list = '/wrk/yuzitong/DONOTREMOVE/OULU/OULU_Protocols/Protocol_1/Dev.txt' test_list = '/wrk/yuzitong/DONOTREMOVE/OULU/OULU_Protocols/Protocol_1/Test.txt' Thus, the videos od OULU dataset should be in Train_image_dir, Test_image_dir, Dev_image_dir and the protocol into Train_list, test_list, val_list.

On Wed, 15 Jul 2020 at 11:53, lz28lz28 notifications@github.com wrote:

@lz28lz28 https://github.com/lz28lz28 @ZitongYu https://github.com/ZitongYu @silvercherry https://github.com/silvercherry

can you please explain to me about the map_dir, and the oulu_npu dataset has video, but as per the source code Train-images, Dev_images, Test_images are required. Can you please explain it to me?

I am also a student, so it will be greatly helpful for me to do my research work.

can you please communicate with me, I tried a lot of ways to communicate with the author

thanks in advance

map dir就是存放图片的路径吧。oulu数据集是视频,自己要处理成图片的,每个视频进行帧提取

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ZitongYu/CDCN/issues/20#issuecomment-658530097, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMM7B2YBRPDPZTC53QW5Z53R3UR2FANCNFSM4NHMPF7Q .

punitha-valli commented 4 years ago

@lz28lz28 @ZitongYu @silvercherry can you please explain to me about the map_dir, and the oulu_npu dataset has video, but as per the source code Train-images, Dev_images, Test_images are required. Can you please explain it to me? I am also a student, so it will be greatly helpful for me to do my research work. can you please communicate with me, I tried a lot of ways to communicate with the author thanks in advance

map dir就是存放图片的路径吧。oulu数据集是视频,自己要处理成图片的,每个视频进行帧提取

Thank you so much, I am really happy about your replay. So there is no need to pre-process the OULU dataset, can I directly feed into the code?

train_image_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/Train_images/' val_image_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/Dev_images/' test_image_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/Test_images/' map_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/IJCB_re/OULUtrain_images/' val_map_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/IJCB_re/OULUdev_images/' test_map_dir = '/wrk/yuzitong/DONOTREMOVE/OULU/IJCB_re/OULUtest_images/' train_list = '/wrk/yuzitong/DONOTREMOVE/OULU/OULU_Protocols/Protocol_1/Train.txt' val_list = '/wrk/yuzitong/DONOTREMOVE/OULU/OULU_Protocols/Protocol_1/Dev.txt' test_list = '/wrk/yuzitong/DONOTREMOVE/OULU/OULU_Protocols/Protocol_1/Test.txt'

Thus, the videos od OULU dataset should be in Train_image_dir, Test_image_dir, Dev_image_dir and the protocol into Train_list, test_list, val_list.

punitha-valli commented 4 years ago

@lz28lz28

Traceback (most recent call last): File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/train_CDCN.py", line 443, in train_test() File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/train_CDCN.py", line 286, in train_test for i, sample_batched in enumerate(dataloader_train): File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/_utils.py", line 369, in reraise raise self.exc_type(msg) FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/Load_OULUNPU_train.py", line 231, in getitem image_x, map_x = self.get_single_image_x(image_path, map_path, videoname) File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/Load_OULUNPU_train.py", line 249, in get_single_image_x frames_total = len([name for name in os.listdir(map_path) if os.path.isfile(os.path.join(map_path, name))]) FileNotFoundError: [Errno 2] No such file or directory: '/media/labpc/rename/face_antispoofing/dataset/data/OULU/Oulutrain_images/3_1_18_2'

I always get this error

punitha-valli commented 4 years ago

@lz28lz28 @ZitongYu @silvercherry can you please explain to me about the map_dir, and the oulu_npu dataset has video, but as per the source code Train-images, Dev_images, Test_images are required. Can you please explain it to me? I am also a student, so it will be greatly helpful for me to do my research work. can you please communicate with me, I tried a lot of ways to communicate with the author thanks in advance

map dir is the path to store pictures. The oulu data set is a video, which must be processed into a picture by itself, and each video is subjected to frame extraction

Traceback (most recent call last): File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/train_CDCN.py", line 443, in train_test() File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/train_CDCN.py", line 286, in train_test for i, sample_batched in enumerate(dataloader_train): File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/_utils.py", line 369, in reraise raise self.exc_type(msg) FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/hermes/anaconda3/envs/face2/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/Load_OULUNPU_train.py", line 231, in getitem image_x, map_x = self.get_single_image_x(image_path, map_path, videoname) File "/media/labpc/rename/face_antispoofing/CDCN-master/CVPR2020_paper_codes/Load_OULUNPU_train.py", line 249, in get_single_image_x frames_total = len([name for name in os.listdir(map_path) if os.path.isfile(os.path.join(map_path, name))]) FileNotFoundError: [Errno 2] No such file or directory: '/media/labpc/rename/face_antispoofing/dataset/data/OULU/Oulutrain_images/3_1_18_2'

I always get this error, Thanks you so much for your reply .

i lkie to communicate forther with you regarding the code punithavalli.krv@gmail.com, its my communication box

punitha-valli commented 4 years ago

@lz28lz28 @silvercherry @ZitongYu

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'D:/face_anti_spoofing/dataset/OULUNPU/Data/demo/Train/Depth_map_1/1_1_01_3'

Even I have images in this folder,...

How about the def single_iamge_x():

I have confusion in it,

Because i have already splitted up the oulu dataset videos 1_1_01_1 into 1_1_01_1_1, 1_1_01_1_2,1_1_01_1_3 like this....,

def get_single_image_x(self, image_path, map_path, videoname):

    for name in os.listdir(map_path):
        print(name)

    print(os.path.isfile(os.path.join(map_path, videoname)))

    frames_total = len([name for name in os.listdir(map_path) if os.path.isfile(os.path.join(map_path, name))])
    #print(frames_total)

    # random choose 1 frame
    for temp in range(500):
        image_id = np.random.randint(1, frames_total-1)

        s = "_%03d_scene" % image_id
        image_name = videoname + s + '.jpg'
        bbox_name = videoname + s + '.dat'
        bbox_path = os.path.join(image_path, bbox_name)
        s = "_%03d_depth1D" % image_id
        map_name = videoname + s + '.jpg'
        map_path2 = os.path.join(map_path, map_name)

        # some .dat & map files have been missing  
        if os.path.exists(bbox_path) & os.path.exists(map_path2):
            map_x_temp2 = cv2.imread(map_path2, 0)
            if map_x_temp2 is not None:
                break

    about this one, 

here the error occurs, FileNotFoundError: [WinError 3] The system cannot find the path specified: 'D:/face_anti_spoofing/dataset/OULUNPU/Data/demo/Train/Depth_map_1/1_1_01_3',..

any to please, explain to me about it,.

Thanks in advance

maywander commented 2 years ago

您好,感谢您开源工作代码,我使用CDCN这个模型进行跨库实验,得到如下的结果(casia的real人脸大部分都判定为fake), TP: 7 TN: 196 FP: 74 FN: 83 Accuracy: 0.5638888888888889 FAR: 0.2740740740740741 FRR: 0.9222222222222223 HTER: 0.5981481481481482 HTER与论文差距较大,想问下您当时有遇到这种问题吗,如果有的话是如何解决的。第二个问题是请问您训练模型时,是在loss最小时保存模型,还是在什么时候保存模型?十分感谢,期待您的回复!

请问在训练完能生成map_x后,如何将模型放在casia数据集上测试呢?从map_score如何判断是真人脸还是假人脸呢?

jamesdongdong commented 2 years ago

您好,感谢您开源工作代码,我使用CDCN这个模型进行跨库实验,得到如下的结果(casia的real人脸大部分都判定为fake), TP: 7 TN: 196 FP: 74 FN: 83 Accuracy: 0.5638888888888889 FAR: 0.2740740740740741 FRR: 0.9222222222222223 HTER: 0.5981481481481482 HTER与论文差距较大,想问下您当时有遇到这种问题吗,如果有的话是如何解决的。第二个问题是请问您训练模型时,是在loss最小时保存模型,还是在什么时候保存模型?十分感谢,期待您的回复!

老哥问题解决了吗?我在casia上train然后replay上检测的话性能还可以,但是反过来的话和你那个差不多,real大部分判断为fake