mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-02-01 06:09:55 +00:00
test: is_all_black rgb test, yolo9c test
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
import pytest
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
from adetailer.mask import dilate_erode, has_intersection, is_all_black, offset
|
||||
@@ -78,6 +80,24 @@ def test_is_all_black_2():
|
||||
assert not is_all_black(img)
|
||||
|
||||
|
||||
def test_is_all_black_rgb_image_pil():
|
||||
img = Image.new("RGB", (10, 10), color="red")
|
||||
assert not is_all_black(img)
|
||||
|
||||
img = Image.new("RGBA", (10, 10), color="red")
|
||||
assert not is_all_black(img)
|
||||
|
||||
|
||||
def test_is_all_black_rgb_image_numpy():
|
||||
img = np.full((10, 10, 4), 127, dtype=np.uint8)
|
||||
with pytest.raises(cv2.error):
|
||||
is_all_black(img)
|
||||
|
||||
img = np.full((4, 10, 10), 0.5, dtype=np.float32)
|
||||
with pytest.raises(cv2.error):
|
||||
is_all_black(img)
|
||||
|
||||
|
||||
def test_has_intersection_1():
|
||||
arr1 = np.array(
|
||||
[
|
||||
|
||||
@@ -11,8 +11,10 @@ from adetailer.ultralytics import ultralytics_predict
|
||||
"face_yolov8n.pt",
|
||||
"face_yolov8n_v2.pt",
|
||||
"face_yolov8s.pt",
|
||||
"face_yolov9c.pt",
|
||||
"hand_yolov8n.pt",
|
||||
"hand_yolov8s.pt",
|
||||
"hand_yolov9c.pt",
|
||||
"person_yolov8n-seg.pt",
|
||||
"person_yolov8s-seg.pt",
|
||||
"person_yolov8m-seg.pt",
|
||||
|
||||
Reference in New Issue
Block a user