Commit b3737fe9 authored by narugo1992's avatar narugo1992
Browse files

dev(narugo): fix this problem

parent 0fa10d8c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1205,7 +1205,7 @@ fabric.properties
/docs/source/**/*.sh.err
/docs/source/**/*.sh.exitcode
/docs/source/**/*.dat.*
!/docs/source/**/benchmark_*.dat.*
!/docs/source/**/*.benchmark.py.*
!/docs/source/_static/**/*
/docs/source/**/*.result.ipynb
/cartpole_dqn_*
+1 −1
Original line number Diff line number Diff line
@@ -46,4 +46,4 @@ builddir:
	@echo $(shell readlink -f ${BUILDDIR}/html)

cleanbm:
	@$(ALL) cleanbm
	$(ALL) cleanbm
+47 −40
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import warnings
from multiprocessing import Process
from typing import Tuple, List

import click
import matplotlib.pyplot as plt
import numpy as np
import psutil
@@ -93,7 +94,7 @@ class BaseBenchmark:
        return final_mems, final_times, final_labels


def create_plot(items: List[Tuple[str, BaseBenchmark]], save_as: str,
def create_plot_cli(items: List[Tuple[str, BaseBenchmark]],
                    title: str = 'Unnamed Benchmark Plot', run_times=15, try_times=10,
                    mem_ylog: bool = False, time_ylog: bool = False,
                    figsize=(720, 420), dpi: int = 300):
@@ -113,6 +114,10 @@ def create_plot(items: List[Tuple[str, BaseBenchmark]], save_as: str,
        else:
            return f'{x * 1.0:.1f}s'

    @click.command()
    @click.option('--output', '-o', 'save_as', type=click.Path(dir_okay=False), required=True,
                  help='Output path of image file.', show_default=True)
    def _execute(save_as):
        fig, axes = plt.subplots(1, 2, figsize=(figsize[0] / INCHES_TO_PIXELS, figsize[1] / INCHES_TO_PIXELS))

        if mem_ylog:
@@ -149,3 +154,5 @@ def create_plot(items: List[Tuple[str, BaseBenchmark]], save_as: str,

        fig.tight_layout()
        plt.savefig(save_as, bbox_inches='tight', dpi=dpi, transparent=True)

    return _execute
+2 −0
Original line number Diff line number Diff line
@@ -45,3 +45,5 @@ clean:
	@$(DEMOS) clean
	@$(NOTEBOOK) clean

cleanbm:
	@$(DEMOS) cleanbm
+3 −4
Original line number Diff line number Diff line
import random

from benchmark import BaseBenchmark, create_plot
from benchmark import BaseBenchmark, create_plot_cli
from imgutils.detect import detect_faces


@@ -23,14 +23,13 @@ class FaceDetectBenchmark(BaseBenchmark):


if __name__ == '__main__':
    create_plot(
    create_plot_cli(
        [
            ('face (yolov8s)', FaceDetectBenchmark('s')),
            ('face (yolov8n)', FaceDetectBenchmark('n')),
        ],
        save_as='benchmark_face_detect.dat.svg',
        title='Benchmark for Anime Face Detections',
        run_times=10,
        try_times=5,
        figsize=(1080, 600)
    )
    )()
Loading