Код: Выделить всё
if __name__ == "__main__":
filePath = 'test_visible.mp4'
output_path = 'output.mp4'
orgCode = '0000111011111110'
addVideoImLabel(filePath=filePath, savePath="dist",orgCode=orgCode, label='Ai')
Код: Выделить всё
/data/home/username/ai_gcmark_alg_video (19.89MB)
├── visible_video_watermark.py (4.75KB)
├── rivagan_32bit_model.pt (1.26MB)
├── .git (7.23MB)
├── test_invisible_video_watermark.py (288b)
├── invisible_video_watermark.py (30.27KB)
├── __pycache__ (83.17KB)
├── .gitignore (47b)
├── test_visible_video_watermark.py (4b)
├── .pytest_cache (798b)
├── __init__.py (0b)
├── test_visible.mp4 (1.25MB)
├── requirements.txt (4.63KB)
├── SimSun.ttf (10.03MB)
├── README.md (2.64KB)
└── .vscode (473b)
Код: Выделить всё
from .invisible_video_watermark import *
import pytest
SAVE_DIR = "dist"
VIDEO_DIR = "test_visible.mp4"
def test_load_model():
model = RivaGAN(data_dim=32)
model = RivaGAN.load(f'rivagan_32bit_model.pt')
assert model != None
Код: Выделить всё
RivaGAN
Наконец-то мой Pytorch –
Код: Выделить всё
pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7
Код: Выделить всё
def test_load_model():
from .invisible_video_watermark import RivaGAN
model = RivaGAN(data_dim=32)
model = RivaGAN.load(f'rivagan_32bit_model.pt')
assert model != None
Код: Выделить всё
pytest
Код: Выделить всё
self = , mod_name = '__main__', name = 'RivaGAN'
def find_class(self, mod_name, name):
if type(name) is str and 'Storage' in name:
try:
return StorageType(name)
except KeyError:
pass
mod_name = load_module_mapping.get(mod_name, mod_name)
> return super().find_class(mod_name, name)
E AttributeError: Can't get attribute 'RivaGAN' on
../miniconda3/envs/video/lib/python3.10/site-packages/torch/serialization.py:1165: AttributeError
======================================================================================= short test summary info =======================================================================================
FAILED test_invisible_video_watermark.py::test_load_model - AttributeError: Can't get attribute 'RivaGAN' on
========================================================================================== 1 failed in 6.30s ==========================================================================================
Подробнее здесь: https://stackoverflow.com/questions/789 ... -from-data