mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-11 22:10:37 +00:00
add ColoDiffusion codes: /ldm/module/, /ldm/data/, /scripts/test/
This commit is contained in:
18
examples/images/diffusion/scripts/tests/test_watermark.py
Normal file
18
examples/images/diffusion/scripts/tests/test_watermark.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import cv2
|
||||
import fire
|
||||
from imwatermark import WatermarkDecoder
|
||||
|
||||
|
||||
def testit(img_path):
|
||||
bgr = cv2.imread(img_path)
|
||||
decoder = WatermarkDecoder('bytes', 136)
|
||||
watermark = decoder.decode(bgr, 'dwtDct')
|
||||
try:
|
||||
dec = watermark.decode('utf-8')
|
||||
except:
|
||||
dec = "null"
|
||||
print(dec)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
fire.Fire(testit)
|
Reference in New Issue
Block a user