hongshuochen / DefakeHop

Official code for DefakeHop: A Light-Weight High-Performance Deepfake Detector
https://arxiv.org/abs/2103.06929
70 stars 24 forks source link

hang in soft classifiers? #1

Closed bitornobit closed 3 years ago

bitornobit commented 3 years ago

i tried to run your code but i got a hang after this output (on ubuntu and anaconda) " (4360, 32, 32, 3) ==============================left_eye============================== ===============DefakeHop Training=============== ===============MultiChannelWiseSaab Training=============== Hop1 Input shape: (4360, 32, 32, 3) Output shape: (4360, 15, 15, 12) Hop2 SaabID: 0 ChannelID: 0 Energy: 0.3909475878148454 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 7) SaabID: 0 ChannelID: 1 Energy: 0.3447543175276042 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 8) SaabID: 0 ChannelID: 2 Energy: 0.10680955446396825 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 8) SaabID: 0 ChannelID: 3 Energy: 0.05905506598019355 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 5) SaabID: 0 ChannelID: 4 Energy: 0.03872900013611077 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 5) SaabID: 0 ChannelID: 5 Energy: 0.023054650053579685 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 8) Hop3 SaabID: 0 ChannelID: 0 Energy: 0.24112964726659797 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 0 ChannelID: 1 Energy: 0.09732579918720609 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 0 ChannelID: 2 Energy: 0.02775095300424238 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 0 ChannelID: 3 Energy: 0.015179178866751176 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 1 ChannelID: 0 Energy: 0.19901943188942417 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 1 Energy: 0.08213302772662819 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 2 Energy: 0.02246967960746773 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 3 Energy: 0.018863600077674066 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 4 Energy: 0.013172183331202066 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 7) SaabID: 2 ChannelID: 0 Energy: 0.04175134624454228 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 2 ChannelID: 1 Energy: 0.01873118654102847 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 6) SaabID: 2 ChannelID: 2 Energy: 0.01694263964772816 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 6) SaabID: 2 ChannelID: 3 Energy: 0.013554258645960802 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 7) SaabID: 3 ChannelID: 0 Energy: 0.024407171663723276 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 3 ChannelID: 1 Energy: 0.02307696785774328 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 4 ChannelID: 0 Energy: 0.014326932815538707 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 4) SaabID: 4 ChannelID: 1 Energy: 0.012846123839138926 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) spent 7.283803701400757 s ===============MultiChannelWiseSaab Transformation=============== Hop1 Input shape: (4360, 32, 32, 3) Output shape: (4360, 15, 15, 12) Hop2 SaabID: 0 ChannelID: 0 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 7) SaabID: 0 ChannelID: 1 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 8) SaabID: 0 ChannelID: 2 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 8) SaabID: 0 ChannelID: 3 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 5) SaabID: 0 ChannelID: 4 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 5) SaabID: 0 ChannelID: 5 Input shape: (4360, 15, 15, 1) Output shape: (4360, 7, 7, 8) Hop3 SaabID: 0 ChannelID: 0 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 0 ChannelID: 1 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 0 ChannelID: 2 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 0 ChannelID: 3 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 1 ChannelID: 0 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 1 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 2 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 3 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 1 ChannelID: 4 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 7) SaabID: 2 ChannelID: 0 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 8) SaabID: 2 ChannelID: 1 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 6) SaabID: 2 ChannelID: 2 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 6) SaabID: 2 ChannelID: 3 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 7) SaabID: 3 ChannelID: 0 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 3 ChannelID: 1 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) SaabID: 4 ChannelID: 0 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 4) SaabID: 4 ChannelID: 1 Input shape: (4360, 7, 7, 1) Output shape: (4360, 3, 3, 5) spent 3.1094441413879395 s ===============Features Dimensions=============== Hop1 (4360, 15, 15, 12) Hop2 (4360, 7, 7, 41) Hop3 (4360, 3, 3, 111) ===============Spatial Dimension Reduction=============== Input shape: (15, 15) 225 Output shape: 32 Input shape: (7, 7) 49 Output shape: 12 Input shape: (3, 3) 9 Output shape: 5 ===============Soft Classifiers=============== " crtl c " ^CTraceback (most recent call last): File "model.py", line 163, in model.fit_region(region, train_images, train_labels, train_names, multi_cwSaab_parm) File "model.py", line 34, in fit_region features = defakehop.fit(images, labels) File "/home/user21/workspace/DefakeHop/defakeHop.py", line 54, in fit fit_all_channel_wise_clf(self.features, labels, n_jobs=4) File "/home/user21/workspace/DefakeHop/defakeHop.py", line 150, in fit_all_channel_wise_clf pool.starmap(fit_channel_wise_clf, parameters) File "/home/user21/anaconda3/lib/python3.8/multiprocessing/pool.py", line 372, in starmap return self._map_async(func, iterable, starmapstar, chunksize).get() File "/home/user21/anaconda3/lib/python3.8/multiprocessing/pool.py", line 765, in get self.wait(timeout) File "/home/user21/anaconda3/lib/python3.8/multiprocessing/pool.py", line 762, in wait self._event.wait(timeout) File "/home/user21/anaconda3/lib/python3.8/threading.py", line 558, in wait signaled = self._cond.wait(timeout) File "/home/user21/anaconda3/lib/python3.8/threading.py", line 302, in wait waiter.acquire() KeyboardInterrupt "

hongshuochen commented 3 years ago

Have solved by adding these 2 lines in model.py. https://github.com/hongshuochen/DefakeHop/blob/74338b7516aa2d4d82b45dc94b1912ee8ad77c1a/model.py#L149-L150

bitornobit commented 3 years ago

Have solved by adding these 2 lines in model.py.

https://github.com/hongshuochen/DefakeHop/blob/74338b7516aa2d4d82b45dc94b1912ee8ad77c1a/model.py#L149-L150

thank you, working for me, super fast

" ..... ===============Soft Classifiers=============== Output shape: (1390, 30) ===============Concatenation=============== ===============Prediction=============== Features shape: (1290, 360) ===============Training Results=============== Frame AUC 1.0 Video AUC 1.0 ===============Testing Results=============== Frame AUC 1.0 Video AUC 1.0 " end of test

hongshuochen commented 3 years ago

Great! Good to hear!