Open dongxiaofei12 opened 1 week ago
And if I want to superimpose my inference onto the original, how do I do that?
i dont understand your question, but if u want to impose the inference on the original image you can use opacity
config_file = 'pspnet_r50-d8_4xb2-40k_cityscapes-512x1024.py' checkpoint_file = 'pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth'
model = init_model(config_file, checkpoint_file, device='cuda:0')
img = 'demo/image.png' # or img = mmcv.imread(img)
result = inference_model(model, img)
output_file = 'result.jpg' show_result_pyplot(model, img, result, show=False, out_file=output_file, opacity=0.5)
image = cv2.imread(output_file) image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # Convert BGR to RGB for correct display
plt.figure(figsize=(10, 10)) plt.imshow(image) plt.axis('off') # Turn off axis plt.show()
Why the result is black when I use this.