Мне нравится делать отступы аргументов двумя блоками, а операторы - одним блоком, например:
for image_pathname in image_directory.iterdir():
image = cv2.imread(str(image_pathname))
input_image = np.resize(
image, (height, width, 3)
).transpose((2,0,1)).reshape(1, 3, height, width)
net.forward_all(data=input_image)
segmentation_index = net.blobs[
'argmax'
].data.squeeze().transpose(1,2,0).astype(np.uint8)
segmentation = np.empty(segmentation_index.shape, dtype=np.uint8)
cv2.LUT(segmentation_index, label_colours, segmentation)
prediction_pathname = prediction_directory / image_pathname.name
cv2.imwrite(str(prediction_pathname), segmentation)