Spaces:
Runtime error
Runtime error
検出で異常を判定するように変更
Browse files- .gitattributes +0 -0
- README.md +0 -0
- __init__.py +0 -0
- app.py +0 -0
- colab-application.py +0 -0
- configs/asahachi_black.yaml +0 -0
- configs/fukazara.yaml +0 -0
- configs/fukazara_scoop_black.yaml +0 -0
- lightning_inference.py +13 -1
- models/asahachi_black.ckpt +0 -0
- models/fukazara.ckpt +0 -0
- models/fukazara_scoop_black.ckpt +0 -0
- requirements.txt +0 -0
- utils/fill_background.py +0 -0
.gitattributes
CHANGED
|
File without changes
|
README.md
CHANGED
|
File without changes
|
__init__.py
CHANGED
|
File without changes
|
app.py
CHANGED
|
File without changes
|
colab-application.py
CHANGED
|
File without changes
|
configs/asahachi_black.yaml
CHANGED
|
File without changes
|
configs/fukazara.yaml
CHANGED
|
File without changes
|
configs/fukazara_scoop_black.yaml
CHANGED
|
File without changes
|
lightning_inference.py
CHANGED
|
@@ -14,6 +14,15 @@ from anomalib.utils.callbacks import get_callbacks
|
|
| 14 |
|
| 15 |
from utils.fill_background import fill_background
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
def infer(
|
| 19 |
input: np.ndarray,
|
|
@@ -78,4 +87,7 @@ def infer(
|
|
| 78 |
# read the output image
|
| 79 |
output_path = "/tmp/" + sessionId + "/tmp/" + input_path.name
|
| 80 |
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
from utils.fill_background import fill_background
|
| 16 |
|
| 17 |
+
def has_blue_pixels(image_path):
|
| 18 |
+
# 画像を読み込む
|
| 19 |
+
image = cv2.imread(str(image_path))
|
| 20 |
+
|
| 21 |
+
# 青色のピクセルに対応するマスクを生成
|
| 22 |
+
blue_pixels = (image[:, :, 0] == 255) & (image[:, :, 1] == 0) & (image[:, :, 2] == 0)
|
| 23 |
+
|
| 24 |
+
# 青色のピクセルが存在するかどうかを判定
|
| 25 |
+
return np.any(blue_pixels)
|
| 26 |
|
| 27 |
def infer(
|
| 28 |
input: np.ndarray,
|
|
|
|
| 87 |
# read the output image
|
| 88 |
output_path = "/tmp/" + sessionId + "/tmp/" + input_path.name
|
| 89 |
|
| 90 |
+
# Check if the output image has blue pixels
|
| 91 |
+
has_blue = has_blue_pixels(output_path)
|
| 92 |
+
|
| 93 |
+
return cv2.imread(str(output_path)), cv2.imread(str(input_path)), has_blue
|
models/asahachi_black.ckpt
CHANGED
|
File without changes
|
models/fukazara.ckpt
CHANGED
|
File without changes
|
models/fukazara_scoop_black.ckpt
CHANGED
|
File without changes
|
requirements.txt
CHANGED
|
File without changes
|
utils/fill_background.py
CHANGED
|
File without changes
|