Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Pytorch and Matplotlib interfering

$
0
0

I'm facing a weird bug with Matplotlib and torch. If I run with this torch.hub.load line the plt.imshow will simply not display anything (even tho frame is a correct image). If I comment this line the plt.imshow works.

Whether this torch.hub.load line is commented or not cv2.imshow will work.

onnx_path = "my_weights.onnx"yolo_path = "lib/yolov5/"torch.hub.load(yolo_path, 'custom', path=onnx_path, source='local') video_reader = VideoReader(str(src_file))# wait for thread to readwhile not video_reader.is_ready():    waiting += 1    time.sleep(1)while(video_reader.is_ready()):   frame = video_reader.frame   #cv2.imshow('image',frame)   #cv2.waitKey(0)   plt.imshow(frame)   plt.axis('off')   plt.show()

It seems i'm missing something but I don't see it. Any help is appreciated :)


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>