Hi I want to save the predicted image in a folder using the same name as the original but my cv2.imwrite is not saving the images in the folder.
path2=r'/data/folder/'
def get_segmented(image):
for i, file in enumerate(glob.glob(image)):
print(file,i)
start_time = time()
image = image_loader(file)
output = model(image)
output = output.detach().cpu()
output = np.resize(output, (160, 160))
img_filename = os.path.splitext(file)[0]
print(cv2.imwrite(path2 + img_filename + '.png',output*255))