found perfect parameters
This commit is contained in:
parent
138037f512
commit
8378215192
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue