Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python 3x pypi

Overview

This module extends tqdm's tqdm class with basic colored sub-progressbars.

Tested in VS Code on a Linux server. No guarantees for other use cases.

Great for ML/DL, to track training loops and evaluation progress. E.g. ballanced training with undersampling and confusion-matrix:

basic

Installation

pip install colortqdm

Usage

Basic usage

Backwards compatible:

from colortqdm import colortqdm as ctqdm
import time

for _ in ctqdm(range(5000)):
    time.sleep(0.001)

basic

Known total:

from colortqdm import colortqdm as ctqdm
import time
import numpy as np

total = 5000
with ctqdm(total=total, desc="Known total") as pbar:
    for i, p in enumerate(np.random.uniform(0,1,total)):
        if p > i / total:
            pbar.update(1, color="green")
        else:
            pbar.update(1, color="red")
        time.sleep(0.001)

known_total

Unknown total:

from colortqdm import colortqdm as ctqdm
import time
import numpy as np

total = 5000
with ctqdm(total=None, desc="Unknown total") as pbar:
    for i, p in enumerate(np.random.uniform(0,1,total)):
        if p > i / total:
            pbar.update(1, color="green")
        else:
            pbar.update(1, color="red")
        time.sleep(0.001)

unknown_total

Available named colors

from colortqdm import colortqdm as ctqdm
import time
import numpy as np

total = 500
with ctqdm(total=total) as pbar:
    x = np.random.randint(0,10,total)
    for i in x:
        if i == 0:
            pbar.update(1, color="blue",    name="blue")
        elif i == 1:
            pbar.update(1, color="orange",  name="orange")
        elif i == 2:
            pbar.update(1, color="green",   name="green")
        elif i == 3:
            pbar.update(1, color="red",     name="red")
        elif i == 4:
            pbar.update(1, color="purple",  name="purple")
        elif i == 5:
            pbar.update(1, color="brown",   name="brown")
        elif i == 6:
            pbar.update(1, color="magenta", name="magenta")
        elif i == 7:
            pbar.update(1, color="grey",    name="grey")
        elif i == 8:
            pbar.update(1, color="yellow",  name="yellow")
        else:
            pbar.update(1)  #default (white)
        time.sleep(0.002)

colors

Custom colors

from colortqdm import colortqdm as ctqdm
import time
import numpy as np

total = 500
with ctqdm(total=total, desc="Custom RGB") as pbar:
    x = np.random.randint(0,4,total)
    for i in x:
        if i == 0:
            pbar.update(1, color=(208,244,244))
        elif i == 1:
            pbar.update(1, color=(238,213,255))
        elif i == 2:
            pbar.update(1, color=(255,192,215))
        else:
            pbar.update(1, color=(255,249,193))
        time.sleep(0.001)

custom_colors

License

This project is licensed under the MIT License (c) 2025 Bálint Csanády, aielte-research. See the LICENSE file for details.

About

Augment the tqdm class with ability to track progress of different categories.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages