segmentation_models icon indicating copy to clipboard operation
segmentation_models copied to clipboard

batch size when predicting

Open vuhungtvt2018 opened this issue 1 year ago • 1 comments

how can I apply batch size when predicting multible image plsease help me! thanks!

vuhungtvt2018 avatar Jul 01 '23 03:07 vuhungtvt2018

@vuhungtvt142 you can try this code snippet:

from glob import glob
import numpy as np
import cv2

images_paths = glob("/*")
images_array = []

for image_path in images_paths:
    image = cv2.imread(image_path)[:,:,::-1]
    images.append(image)

images_array = np.asarray(images_array).reshape(len(images_paths), H, W, N_CHANNELS)

predictions = model.predict(images_array)

Please let me know if this works! Also, close the issue if this solves the problem!!!:)

tshr-d-dragon avatar Sep 21 '23 10:09 tshr-d-dragon