jhc13 / taggui

Tag manager and captioner for image datasets
GNU General Public License v3.0
774 stars 37 forks source link

keep track of times #179

Closed geroldmeisinger closed 5 months ago

geroldmeisinger commented 5 months ago

see #173

keep track of captioning_time, print start time, end time, avg time and duration:

print(f"Captioning started at {start_datetime.strftime('%Y-%m-%d %H:%M:%S')}")
...
print(f"\nCaptioning finished in {get_pretty_duration(diff_secs)} (avg: {avg_time:.1f} s/img) at {end_datetime.strftime('%Y-%m-%d %H:%M:%S')}")

added get_pretty_duration which prints in highest unit of time

    if seconds < MIN:
        return f"{seconds:.1f} s"
    elif seconds < HOUR:
        return f"{(seconds / MIN):.1f} min"
    elif seconds < DAY:
        return f"{(seconds / HOUR):.1f} h"
    else:
        return f"{(seconds / DAY):.1f} d"

@jhc13: i don't know why in captioning_thread.py 403 the prints are deleted after the first captioning:

        if are_multiple_images_selected:
            print(f"Captioning started at {start_datetime.strftime('%Y-%m-%d %H:%M:%S')}")
        captioning_times = []
        for i, image_index in enumerate(self.selected_image_indices):
            ...

@jhc13: how to show average in progress bar? the only solution I found is with some signal-slots and manually setting progressBar.setFormat

jhc13 commented 5 months ago

@jhc13: i don't know why in captioning_thread.py 403 the prints are deleted after the first captioning

It's because of this.

@jhc13: how to show average in progress bar? the only solution I found is with some signal-slots and manually setting progressBar.setFormat

It seems impossible, even with setFormat(). That's why I did not add time estimates in the progress bar.

geroldmeisinger commented 5 months ago

@jhc13: i don't know why in captioning_thread.py 403 the prints are deleted after the first captioning

It's because of this.

ugh, how could I miss that. can we remove it? (I want the start time in console.)

@jhc13: how to show average in progress bar? the only solution I found is with some signal-slots and manually setting progressBar.setFormat

It seems impossible, even with setFormat(). That's why I did not add time estimates in the progress bar.

do we want it though? then I will investigate.

jhc13 commented 5 months ago

can we remove it? (I want the start time in console.)

There's probably a way to work around it so that the start time isn't cleared.

do we want it though? then I will investigate.

It would be nice to have a tqdm-like progress bar, but it might be too complicated to implement.

geroldmeisinger commented 5 months ago

btw: why 80 character limit?

jhc13 commented 5 months ago

https://peps.python.org/pep-0008/#maximum-line-length