Spaces:
Sleeping
Sleeping
update changes
Browse files- __pycache__/inference_2.cpython-39.pyc +0 -0
- inference_2.py +1 -14
__pycache__/inference_2.cpython-39.pyc
CHANGED
|
Binary files a/__pycache__/inference_2.cpython-39.pyc and b/__pycache__/inference_2.cpython-39.pyc differ
|
|
|
inference_2.py
CHANGED
|
@@ -96,23 +96,10 @@ get_args(parser)
|
|
| 96 |
args, remaining_args = parser.parse_known_args()
|
| 97 |
assert remaining_args == [], remaining_args
|
| 98 |
|
| 99 |
-
# multimodal = load_multimodal_model(args)
|
| 100 |
spec_model = load_spec_modality_model(args)
|
| 101 |
|
| 102 |
-
# print(f"Spec model is: {spec_model}")
|
| 103 |
-
|
| 104 |
img_model = load_img_modality_model(args)
|
| 105 |
|
| 106 |
-
# print(f"Image model is: {img_model}")
|
| 107 |
-
|
| 108 |
-
# spec_in = torch.randn(1, 10_000)
|
| 109 |
-
# rgb_in = torch.randn([1, 3, 256, 256])
|
| 110 |
-
|
| 111 |
-
# rgb_out = img_model(rgb_in)
|
| 112 |
-
# spec_out = spec_model(spec_in)
|
| 113 |
-
|
| 114 |
-
# print(f"Img input shape is: {rgb_in.shape}, output shape: {rgb_out}")
|
| 115 |
-
# print(f"Spec input shape is: {spec_in.shape}, output shape is: {spec_out.shape} output: {spec_out}")
|
| 116 |
|
| 117 |
def preprocess_img(face):
|
| 118 |
face = face / 255
|
|
@@ -129,7 +116,7 @@ def deepfakes_spec_predict(input_audio):
|
|
| 129 |
x, _ = input_audio
|
| 130 |
audio = preprocess_audio(x)
|
| 131 |
spec_grads = spec_model.forward(audio)
|
| 132 |
-
spec_grads_inv = np.exp(spec_grads.cpu().numpy().squeeze())
|
| 133 |
|
| 134 |
# multimodal_grads = multimodal.spec_depth[0].forward(spec_grads)
|
| 135 |
|
|
|
|
| 96 |
args, remaining_args = parser.parse_known_args()
|
| 97 |
assert remaining_args == [], remaining_args
|
| 98 |
|
|
|
|
| 99 |
spec_model = load_spec_modality_model(args)
|
| 100 |
|
|
|
|
|
|
|
| 101 |
img_model = load_img_modality_model(args)
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
def preprocess_img(face):
|
| 105 |
face = face / 255
|
|
|
|
| 116 |
x, _ = input_audio
|
| 117 |
audio = preprocess_audio(x)
|
| 118 |
spec_grads = spec_model.forward(audio)
|
| 119 |
+
spec_grads_inv = np.exp(spec_grads.cpu().detach().numpy().squeeze())
|
| 120 |
|
| 121 |
# multimodal_grads = multimodal.spec_depth[0].forward(spec_grads)
|
| 122 |
|