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

Model error while running yolo.py on Raspberry Pi 4 #3071

Closed
jaskiratsingh2000 opened this issue May 7, 2021 · 15 comments
Closed

Model error while running yolo.py on Raspberry Pi 4 #3071

jaskiratsingh2000 opened this issue May 7, 2021 · 15 comments
Labels
question Further information is requested Stale

Comments

@jaskiratsingh2000
Copy link

jaskiratsingh2000 commented May 7, 2021

Additional context

Hey, I am actually trying to evaluate the performance of each layer, that is checking the latency by getting the time period for each layer on my raspberry pi terminal. I just ran the following command as stated in #2898 (comment)

cd yolov5
python models/yolo.py

The error I am getting is the following,

from models.common import *
ModuleNotFoundError: No module named 'models'

@glenn-jocher can you please let me know how I can run that successfully.

Thanks

@jaskiratsingh2000 jaskiratsingh2000 added the question Further information is requested label May 7, 2021
@jaskiratsingh2000 jaskiratsingh2000 changed the title Module error while running yolo.py on Raspberry Pi 4 Model error while running yolo.py on Raspberry Pi 4 May 7, 2021
@jaskiratsingh2000
Copy link
Author

Hey, @glenn-jocher @pravastacaraka Do you have any idea about it?

@pravastacaraka
Copy link

Hey, @glenn-jocher @pravastacaraka Do you have any idea about it?

@jaskiratsingh2000 I don't get any error from your run command

(yolov5) D:\Proyek_Akhir\yolov5>python models/yolo.py      
YOLOv5  v5.0-73-gd2a1728 torch 1.8.1+cu111 CUDA:0 (NVIDIA GeForce MX150, 2048.0MB)

                 from  n    params  module                                  arguments
  0                -1  1      3520  models.common.Focus                     [3, 32, 3]
  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]
  2                -1  1     18816  models.common.C3                        [64, 64, 1]
  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]
  4                -1  1    156928  models.common.C3                        [128, 128, 3]
  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]
  6                -1  1    625152  models.common.C3                        [256, 256, 3]
  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]
  8                -1  1    656896  models.common.SPP                       [512, 512, [5, 9, 13]]        
  9                -1  1   1182720  models.common.C3                        [512, 512, 1, False]
 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]
 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']
 12           [-1, 6]  1         0  models.common.Concat                    [1]
 13                -1  1    361984  models.common.C3                        [512, 256, 1, False]
 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]
 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']
 16           [-1, 4]  1         0  models.common.Concat                    [1]
 17                -1  1     90880  models.common.C3                        [256, 128, 1, False]
 18                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]
 19          [-1, 14]  1         0  models.common.Concat                    [1]
 20                -1  1    296448  models.common.C3                        [256, 256, 1, False]
 21                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]
 22          [-1, 10]  1         0  models.common.Concat                    [1]
 23                -1  1   1182720  models.common.C3                        [512, 512, 1, False]
 24      [17, 20, 23]  1    229245  Detect                                  [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]
Model Summary: 283 layers, 7276605 parameters, 7276605 gradients, 17.1 GFLOPS

@glenn-jocher
Copy link
Member

glenn-jocher commented May 8, 2021

@jaskiratsingh2000 your command is correct, I don't see anything wrong.

If you believe you have a reproducible issue, we suggest you close this issue and raise a new one using the 🐛 Bug Report template, providing screenshots and a minimum reproducible example to help us better understand and diagnose your problem. Thank you!

@jaskiratsingh2000
Copy link
Author

jaskiratsingh2000 commented May 8, 2021

@glenn-jocher @pravastacaraka Did you check on raspberry pi? Because I am running this on raspberry pi and getting the model error as stated above

Inorder to test, maybe you could check in with some linux distro

@glenn-jocher
Copy link
Member

@jaskiratsingh2000 no, unfortunately we don't have a raspberry pi handy to check with, but I think if your directory structure is correct and you are running the command from yolov5/ everything should work.

@jaskiratsingh2000
Copy link
Author

Yes, everything from directory and structure is fine but running these command or directly running the "yolo.py" throws me the model error which I have stated above

@pravastacaraka
Copy link

Yes, everything from directory and structure is fine but running these command or directly running the "yolo.py" throws me the model error which I have stated above

Yes, there is still a bug even though it has been fixed with PR #2949. And this is a reproducible command:

cd yolov5/models
python yolo.py

@glenn-jocher
Copy link
Member

@pravastacaraka yes that command will not work (we tried to fix with #2949 but no luck), but the intended use case is actually for running commands from the yolov5/ directory, like export.py:

git clone https://github.com/ultralytics/yolov5
cd yolov5

python models/export.py
python models/yolo.py

Perhaps we need a comment at the top of yolo.py with a 'Usage:' example like we have with export.py:

"""Exports a YOLOv5 *.pt model to ONNX and TorchScript formats
Usage:
$ export PYTHONPATH="$PWD" && python models/export.py --weights yolov5s.pt --img 640 --batch 1
"""

@jaskiratsingh2000
Copy link
Author

jaskiratsingh2000 commented May 9, 2021

So, @glenn-jocher @pravastacaraka Is there a way then I can run this command or any other command in order to produce latency without any errors? If yes, then can you let me know the steps t reproduce?
@glenn-jocher @pravastacaraka please let me know

@jaskiratsingh2000
Copy link
Author

@glenn-jocher I am still looking forward to your response. Please let me know

@glenn-jocher
Copy link
Member

@jaskiratsingh2000 sorry, I can't answer this myself as we don't have any Raspberry Pi 4 hardware to test on.

@jaskiratsingh2000
Copy link
Author

jaskiratsingh2000 commented May 10, 2021

@glenn-jocher I am not saying you to directly test on the raspberry pi but you can test that command on any Linux distribution as well.
You were saying above to use the usage like this above. Can you tell me that how can I use that similar command in the yolo.py ?


 """Exports a YOLOv5 *.pt model to ONNX and TorchScript formats 
  
 Usage: 
     $ export PYTHONPATH="$PWD" && python models/export.py --weights yolov5s.pt --img 640 --batch 1 
 """ 

@glenn-jocher Do let me know if this can be worked out in any sense?

@glenn-jocher
Copy link
Member

glenn-jocher commented May 10, 2021

@jaskiratsingh2000 usage example of yolo.py is just to run it from your yolov5 directory:

git clone https://github.com/ultralytics/yolov5
cd yolov5
python models/yolo.py

@jaskiratsingh2000
Copy link
Author

@glenn-jocher yeah I see but even when I don't run the commands and directly open the "yolo.py" from the directory after cloning it shows me same "model" error

@github-actions
Copy link
Contributor

github-actions bot commented Jun 10, 2021

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

3 participants