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

TypeError: int() can't convert non-string with explicit base #2066

Closed
laenix opened this issue Jan 28, 2021 · 4 comments · Fixed by #2069
Closed

TypeError: int() can't convert non-string with explicit base #2066

laenix opened this issue Jan 28, 2021 · 4 comments · Fixed by #2069
Labels
bug Something isn't working

Comments

@laenix
Copy link

laenix commented Jan 28, 2021

TypeError: int() can't convert non-string with explicit base

Input:

python train.py --img 640 --batch 16 --epochs 5 --data ./data/dataset/dataset.yaml --cfg ./models/yolov5s.yaml --weights ''

Output:

Traceback (most recent call last):
  File "D:\software\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "D:\software\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\yolov5\utils\plots.py", line 124, in plot_images
    colors = color_list()  # list of colors
  File "D:\yolov5\utils\plots.py", line 34, in color_list
    return [hex2rgb(h) for h in plt.rcParams['axes.prop_cycle'].by_key()['color']]
  File "D:\yolov5\utils\plots.py", line 34, in <listcomp>
    return [hex2rgb(h) for h in plt.rcParams['axes.prop_cycle'].by_key()['color']]
  File "D:\yolov5\utils\plots.py", line 32, in hex2rgb
    return tuple(int(h[1 + i:1 + i + 2], 16) for i in (0, 2, 4))
  File "D:\yolov5\utils\plots.py", line 32, in <genexpr>
    return tuple(int(h[1 + i:1 + i + 2], 16) for i in (0, 2, 4))
TypeError: int() can't convert non-string with explicit base

Environment

If applicable, add screenshots to help explain your problem.

  • OS: [Windows 10]
  • GPU [1660 super]

Additional context

def color_list():
    # Return first 10 plt colors as (r,g,b) https://stackoverflow.com/questions/51350872/python-from-color-name-to-rgb
    def hex2rgb(h):
        return tuple(int(h[1 + i:1 + i + 2], 16) for i in (0, 2, 4))

    return [hex2rgb(h) for h in plt.rcParams['axes.prop_cycle'].by_key()['color']]
@laenix laenix added the bug Something isn't working label Jan 28, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2021

👋 Hello @laenix, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

@laenix
Copy link
Author

laenix commented Jan 28, 2021

Uploading image.png…

@glenn-jocher
Copy link
Member

@laenix thanks for the bug report. What version of matplotlib are you using?

import matplotlib

print(matplotlib.__version__)

@glenn-jocher
Copy link
Member

@laenix could you try the following two blocks of code and see if they work for you?

Block 1

import matplotlib

def color_list():
    # Return first 10 plt colors as (r,g,b) https://stackoverflow.com/questions/51350872/python-from-color-name-to-rgb
    def hex2rgb(h):
        return tuple(int(h[1 + i:1 + i + 2], 16) for i in (0, 2, 4))

    return [hex2rgb(h) for h in plt.rcParams['axes.prop_cycle'].by_key()['color']]

print(color_list())

Block 2

import matplotlib

def color_list():
    # Return first 10 plt colors as (r,g,b) https://stackoverflow.com/questions/51350872/python-from-color-name-to-rgb
    def hex2rgb(h):
        return tuple(int(h[1 + i:1 + i + 2], 16) for i in (0, 2, 4))

    return [hex2rgb(h) for h in matplotlib.colors.TABLEAU_COLORS.values()]

print(color_list())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants