found perfect parameters

This commit is contained in:
千住柱間 2025-04-21 01:36:41 -04:00
commit 8378215192
Signed by: hashirama
GPG key ID: 53E62470A86BC185

View file

@ -111,12 +111,12 @@ def preprocess_image(image_path):
gray = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
# Convert grayscale to 3-channel RGB by duplicating the gray channel
img = adjust_gamma(cv2.cvtColor(gray, cv2.COLOR_GRAY2RGB),gamma=2.2)
img = adjust_gamma(cv2.cvtColor(gray, cv2.COLOR_GRAY2RGB),gamma=2)
mat_in = ncnn.Mat.from_pixels_resize(
img, ncnn.Mat.PixelType.PIXEL_RGB, img.shape[1], img.shape[0], 224, 224
)
mean_vals = [0.5, 0.5, 0.5] * 1
mean_vals = [0.5, 0.5, 0.5] * 3
norm_vals = [1/255, 1/255, 1/255] * 3
mat_in.substract_mean_normalize(mean_vals, norm_vals)
return mat_in