test: is_all_black rgb test, yolo9c test

This commit is contained in:
Dowon
2024-03-21 00:34:19 +09:00
parent 9d3f178573
commit eb63f828de
2 changed files with 22 additions and 0 deletions

View File

@@ -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(
[

View File

@@ -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",