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

Error while using the CLI command 'tools "path/to/best.pt"' #122

Open
lejrn opened this issue Dec 19, 2024 · 3 comments
Open

Error while using the CLI command 'tools "path/to/best.pt"' #122

lejrn opened this issue Dec 19, 2024 · 3 comments
Assignees

Comments

@lejrn
Copy link

lejrn commented Dec 19, 2024

Hey great team,

I'm facing this error while trying to run the CLI command through Windows PowerShell. Did I miss anything?

INFO:tools.main:Converting model...
'unzip' is not recognized as an internal or external command,
operable program or batch file.
╭─────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────╮
│ C:\Repos\repo\.venv\lib\site-packages\tools\utils\version_detection.py:35 in detect_version                                       │
│                                                                                                                                                          │
│   32 │   │   │   │   f"rm -r extracted_model && unzip {path} -d extracted_model", shell=True                                                             │
│   33 │   │   │   )                                                                                                                                       │
│   34 │   │   else:                                                                                                                                       │
│ ❱ 35 │   │   │   subprocess.check_output(f"unzip {path} -d extracted_model", shell=True)                                                                 │
│   36 │   │   folder = [                                                                                                                                  │
│   37 │   │   │   f for f in listdir("extracted_model") if isdir(join("extracted_model", f))                                                              │
│   38 │   │   ][0]                                                                                                                                        │
│                                                                                                                                                          │
│ ╭─────────────────────────────────────────── locals ────────────────────────────────────────────╮                                                        │
│ │ debug = False                                                                                 │                                                        │
│ │  path = 'C:\\Repos\\repo\\runs\\cycle\\weights\\best.pt' │                                                        │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯                                                        │
│                                                                                                                                                          │
│ C:\Python-3-10\lib\subprocess.py:420 in check_output                                                                                                     │
│                                                                                                                                                          │
│    417 │   │   │   empty = b''                                                                                                                           │
│    418 │   │   kwargs['input'] = empty                                                                                                                   │
│    419 │                                                                                                                                                 │
│ ❱  420 │   return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,                                                                              │
│    421 │   │   │      **kwargs).stdout                                                                                                                   │
│    422                                                                                                                                                   │
│    423                                                                                                                                                   │
│                                                                                                                                                          │
│ ╭────────────────────────────────────────────────── locals ──────────────────────────────────────────────────╮                                           │
│ │    kwargs = {'shell': True}                                                                                │                                           │
│ │ popenargs = ('unzip C:\\Repos\\repo\\runs\\cycle\\weights\\best'+22,) │                                           │
│ │   timeout = None                                                                                           │                                           │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                           │
│                                                                                                                                                          │
│ C:\Python-3-10\lib\subprocess.py:524 in run                                                                                                              │
│                                                                                                                                                          │
│    521 │   │   │   raise                                                                                                                                 │
│    522 │   │   retcode = process.poll()                                                                                                                  │
│    523 │   │   if check and retcode:                                                                                                                     │
│ ❱  524 │   │   │   raise CalledProcessError(retcode, process.args,                                                                                       │
│    525 │   │   │   │   │   │   │   │   │    output=stdout, stderr=stderr)                                                                                │
│    526 │   return CompletedProcess(process.args, retcode, stdout, stderr)                                                                                │
│    527                                                                                                                                                   │
│                                                                                                                                                          │
│ ╭──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮                                      │
│ │ capture_output = False                                                                                          │                                      │
│ │          check = True                                                                                           │                                      │
│ │          input = None                                                                                           │                                      │
│ │         kwargs = {'stdout': -1, 'shell': True}                                                                  │                                      │
│ │      popenargs = ('unzip C:\\Repos\\repo\\runs\\cycle\\weights\\best'+22,) │                                      │
│ │        process = <Popen: returncode: 1 args: 'unzip C:\\Repos\\repo\\r...>               │                                      │
│ │        retcode = 1                                                                                              │                                      │
│ │         stderr = None                                                                                           │                                      │
│ │         stdout = b''                                                                                            │                                      │
│ │        timeout = None                                                                                           │                                      │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
CalledProcessError: Command 'unzip C:\Repos\repo\runs\cycle\weights\best.pt -d extracted_model' returned non-zero exit 
status 1.

The above exception was the direct cause of the following exception:

╭─────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────╮
│ C:\Repos\repo\.venv\lib\site-packages\tools\main.py:116 in convert                                                                │
│                                                                                                                                                          │
│   113 │   model_path = resolve_path(config.model, MISC_DIR)                                                                                              │
│   114 │                                                                                                                                                  │
│   115 │   if version is None:                                                                                                                            │
│ ❱ 116 │   │   version = detect_version(str(model_path))                                                                                                  │
│   117 │   │   logger.info(f"Detected version: {version}")                                                                                                │
│   118 │                                                                                                                                                  │
│   119 │   try:                                                                                                                                           │
│                                                                                                                                                          │
│ ╭─────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────╮                                 │
│ │       class_names = None                                                                                             │                                 │
│ │            config = Config(                                                                                          │                                 │
│ │                     │   model='C:\\Repos\\repo\\runs\\cycle\\weights\\best.pt', │                                 │
│ │                     │   imgsz=[416, 416],                                                                            │                                 │
│ │                     │   class_names=None,                                                                            │                                 │
│ │                     │   use_rvc2=True,                                                                               │                                 │
│ │                     │   output_remote_url=None,                                                                      │                                 │
│ │                     │   put_file_plugin=None                                                                         │                                 │
│ │                     )                                                                                                │                                 │
│ │       config_path = None                                                                                             │                                 │
│ │             imgsz = [416, 416]                                                                                       │                                 │
│ │            logger = <Logger tools.main (INFO)>                                                                       │                                 │
│ │             model = 'C:\\Repos\\repo\\runs\\cycle\\weights\\best.pt'            │                                 │
│ │        model_path = WindowsPath('C:/Repos/repo/runs/cycle/weights/best.pt')     │                                 │
│ │ output_remote_url = None                                                                                             │                                 │
│ │   put_file_plugin = None                                                                                             │                                 │
│ │          use_rvc2 = True                                                                                             │                                 │
│   89 │                                                                                                                                                   │
│   90 │   return UNRECOGNIZED                                                                                                                             │
│   91                                                                                                                                                     │
│                                                                                                                                                          │
│ ╭─────────────────────────────────────────── locals ────────────────────────────────────────────╮                                                        │
│ │ debug = False                                                                                 │                                                        │
│ │  path = 'C:\\Repos\\repo\\runs\\cycle\\weights\\best.pt' │                                                        │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError```
@HonzaCuhel HonzaCuhel self-assigned this Dec 19, 2024
@HonzaCuhel
Copy link
Contributor

Hi @lejrn,

the problem is that the unzip command is missing in the Powershell. I'll take a closer look and try to find an alternative for Windows. In the meantime what you can do is to specify the version of the YOLO you are attempting to convert and it should run without an error. Currently we support conversion of the following models: "goldyolo", "yolov5", "yolov6r1", "yolov6r3", "yolov6r4", "yolov7", "yolov8", "yolov9", "yolov10", "yolov11".

Kind regards,
Jan

@lejrn
Copy link
Author

lejrn commented Dec 19, 2024

Hi @lejrn,

the problem is that the unzip command is missing in the Powershell. I'll take a closer look and try to find an alternative for Windows. In the meantime what you can do is to specify the version of the YOLO you are attempting to convert and it should run without an error. Currently we support conversion of the following models: "goldyolo", "yolov5", "yolov6r1", "yolov6r3", "yolov6r4", "yolov7", "yolov8", "yolov9", "yolov10", "yolov11".

Kind regards, Jan

Thanks @HonzaCuhel
Let's say that I mention "yolov8", how would it know the path to the model?
what arguments do I use for each? (yolov8 and path)

@HonzaCuhel
Copy link
Contributor

It'll know by passing the path to the model and specifying the version, so for example like this:

tools path --imgsz "512 288" --version "yolov8"

In your case then:

tools C:/Repos/repo/runs/cycle/weights/best.pt --imgsz "512 288" --version "yolov8"

Best,
Jan

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