Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead. #18

Open
pcdreams2 opened this issue Dec 2, 2020 · 1 comment

Comments

@pcdreams2
Copy link

When I run a test with a webcam or file, an error is thrown:
Traceback (most recent call last): File "video_deepsort.py", line 47, in <module> for image, detections, _ in video_detector.detect("rtsp://admin:[email protected]/ISAPI/Streaming/Channels/101", File "A:\ml\yolo_deepsort\yolo3\detect\video_detect.py", line 135, in detect detections = self.image_detector.detect(frame) File "A:\ml\yolo_deepsort\yolo3\detect\img_detect.py", line 86, in detect detections = self.model(image) File "C:\Users\pcdreams\miniconda3\envs\yolo_deepsort\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "A:\ml\yolo_deepsort\yolo3\models\models.py", line 308, in forward x, layer_loss = module[0](x, targets, img_dim) File "C:\Users\pcdreams\miniconda3\envs\yolo_deepsort\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "A:\ml\yolo_deepsort\yolo3\models\models.py", line 217, in forward pred_conf.view((num_samples, -1, 1)), RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

whats a problem with view?

pytorch - 1.7.0
torchvision - 0.8.1
opencv-python - 4.4.0.46

@GlassyWing
Copy link
Owner

Seems like the newest pytorch requires more strictly, pull the latest code and try it again.Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants