Parcourir la source

Fix `plot_labels()` colored histogram bug (#6574)

* Fix `plot_labels()` colored histogram bug

* Cleanup
modifyDataloader
Glenn Jocher GitHub il y a 2 ans
Parent
révision
f627bc53f8
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. +4
    -1
      utils/plots.py

+ 4
- 1
utils/plots.py Voir le fichier

@@ -340,7 +340,10 @@ def plot_labels(labels, names=(), save_dir=Path('')):
matplotlib.use('svg') # faster
ax = plt.subplots(2, 2, figsize=(8, 8), tight_layout=True)[1].ravel()
y = ax[0].hist(c, bins=np.linspace(0, nc, nc + 1) - 0.5, rwidth=0.8)
[y[2].patches[i].set_color([x / 255 for x in colors(i)]) for i in range(nc)] # update colors bug #3195
try: # color histogram bars by class
[y[2].patches[i].set_color([x / 255 for x in colors(i)]) for i in range(nc)] # known issue #3195
except Exception:
pass
ax[0].set_ylabel('instances')
if 0 < len(names) < 30:
ax[0].set_xticks(range(len(names)))

Chargement…
Annuler
Enregistrer