diff --git a/.github/workflows/issue-controller.yaml b/.github/workflows/issue-controller.yaml new file mode 100644 index 00000000..901cce08 --- /dev/null +++ b/.github/workflows/issue-controller.yaml @@ -0,0 +1,77 @@ +name: Issue Controller + +on: + issues: + types: [opened, edited] + +jobs: + add-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Assign Zerohertz to issue + if: github.event_name == 'issues' && github.event.action == 'opened' + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GH_TOKEN}} + script: | + github.rest.issues.addAssignees({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + assignees: ['Zerohertz'] + }) + + - name: Add 'fix' label + if: contains(github.event.issue.title, '[Bug]') + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GH_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['fix'] + }) + + - name: Add 'chore' label + if: contains(github.event.issue.title, '[Chore]') + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GH_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['chore'] + }) + + - name: Add 'style' label + if: contains(github.event.issue.title, '[Style]') + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GH_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['style'] + }) + + - name: Add 'docs' label + if: contains(github.event.issue.title, '[Docs]') + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GH_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['docs'] + }) diff --git a/.github/workflows/pr-controller.yaml b/.github/workflows/pr-controller.yaml new file mode 100644 index 00000000..64fd153f --- /dev/null +++ b/.github/workflows/pr-controller.yaml @@ -0,0 +1,94 @@ +name: PR Controller + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + add-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Assign Zerohertz to PR + if: github.event_name == 'pull_request' && github.event.action == 'opened' + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GH_TOKEN}} + script: | + github.rest.issues.addAssignees({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + assignees: ['Zerohertz'] + }) + + - name: Add labels based on file path and branch + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GH_TOKEN}} + script: | + const baseBranch = context.payload.pull_request.base.ref; + const headBranch = context.payload.pull_request.head.ref; + const issueNumber = context.issue.number; + const owner = context.repo.owner; + const repo = context.repo.repo; + + let labelsToAdd = []; + + // Check for PR from dev* to master + if (baseBranch === 'master' && headBranch.startsWith('dev')) { + const files = await github.rest.pulls.listFiles({ + owner, + repo, + pull_number: issueNumber + }); + + files.data.forEach(file => { + if (file.filename.startsWith('Jenkins') || file.filename.startsWith('.github/workflows')) { + labelsToAdd.push('chore'); + } + if (file.filename.startsWith('docs')) { + labelsToAdd.push('docs'); + } + if (file.filename.startsWith('zerohertzLib/algorithm/')) { + labelsToAdd.push('feat/algorithm'); + } + if (file.filename.startsWith('zerohertzLib/api/')) { + labelsToAdd.push('feat/api'); + } + if (file.filename.startsWith('zerohertzLib/logging/')) { + labelsToAdd.push('feat/logging'); + } + if (file.filename.startsWith('zerohertzLib/mlops/')) { + labelsToAdd.push('feat/mlops'); + } + if (file.filename.startsWith('zerohertzLib/monitoring/')) { + labelsToAdd.push('feat/monitoring'); + } + if (file.filename.startsWith('zerohertzLib/plot/')) { + labelsToAdd.push('feat/plot'); + } + if (file.filename.startsWith('zerohertzLib/vision/')) { + labelsToAdd.push('feat/vision'); + } + }); + } + + // Check for PR from docs to dev* + if (baseBranch.startsWith('dev') && headBranch === 'docs') { + labelsToAdd.push('docs'); + } + + // Remove duplicates + labelsToAdd = [...new Set(labelsToAdd)]; + + if (labelsToAdd.length > 0) { + await github.rest.issues.addLabels({ + issue_number: issueNumber, + owner, + repo, + labels: labelsToAdd + }); + } diff --git a/docs/.buildinfo b/docs/.buildinfo index 756431a5..c0d2f8ef 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: b86311c7586fa57666c7690e5c70b7bc +config: 6fbcbe72d420881baa277b9abae1647f tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_sources/zerohertzLib.monitoring.rst.txt b/docs/_sources/zerohertzLib.monitoring.rst.txt index 1a7b0778..12e4b767 100644 --- a/docs/_sources/zerohertzLib.monitoring.rst.txt +++ b/docs/_sources/zerohertzLib.monitoring.rst.txt @@ -1,5 +1,5 @@ zerohertzLib.monitoring package -============================== +================================= Module contents --------------- diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index ebd04418..ffd91758 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: 'v0.1.9', + VERSION: 'v0.1.10', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/genindex.html b/docs/genindex.html index 6434aa07..d9920f26 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -3,14 +3,14 @@ - Index — zerohertzLib v0.1.9 documentation + Index — zerohertzLib v0.1.10 documentation - + @@ -114,10 +114,12 @@

B

    -
  • barh() (in module zerohertzLib.plot) +
  • before_after() (in module zerohertzLib.vision)
  • bfs() (in module zerohertzLib.algorithm)
  • @@ -164,6 +166,10 @@

    G

    +
    @@ -256,6 +262,8 @@

    P

    S

    diff --git a/docs/index.html b/docs/index.html index 49e7704b..e62a506b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,14 +4,14 @@ - Indices and tables — zerohertzLib v0.1.9 documentation + Indices and tables — zerohertzLib v0.1.10 documentation - + diff --git a/docs/modules.html b/docs/modules.html index def08e62..3f0fdc41 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -4,14 +4,14 @@ - zerohertzLib — zerohertzLib v0.1.9 documentation + zerohertzLib — zerohertzLib v0.1.10 documentation - + diff --git a/docs/objects.inv b/docs/objects.inv index e002c83f..98c67ff5 100644 Binary files a/docs/objects.inv and b/docs/objects.inv differ diff --git a/docs/py-modindex.html b/docs/py-modindex.html index 87111b46..e432b527 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -3,14 +3,14 @@ - Python Module Index — zerohertzLib v0.1.9 documentation + Python Module Index — zerohertzLib v0.1.10 documentation - + diff --git a/docs/search.html b/docs/search.html index 4f68c778..15182911 100644 --- a/docs/search.html +++ b/docs/search.html @@ -3,7 +3,7 @@ - Search — zerohertzLib v0.1.9 documentation + Search — zerohertzLib v0.1.10 documentation @@ -11,7 +11,7 @@ - + diff --git a/docs/searchindex.js b/docs/searchindex.js index 5746f58c..5d3c1c75 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["index", "modules", "zerohertzLib", "zerohertzLib.algorithm", "zerohertzLib.api", "zerohertzLib.logging", "zerohertzLib.mlops", "zerohertzLib.monitoring", "zerohertzLib.plot", "zerohertzLib.vision"], "filenames": ["index.rst", "modules.rst", "zerohertzLib.rst", "zerohertzLib.algorithm.rst", "zerohertzLib.api.rst", "zerohertzLib.logging.rst", "zerohertzLib.mlops.rst", "zerohertzLib.monitoring.rst", "zerohertzLib.plot.rst", "zerohertzLib.vision.rst"], "titles": ["Indices and tables", "zerohertzLib", "zerohertzLib package", "zerohertzLib.algorithm package", "zerohertzLib.api package", "zerohertzLib.logging package", "zerohertzLib.mlops package", "zerohertzLib.monitoring package", "zerohertzLib.plot package", "zerohertzLib.vision package"], "terms": {"zerohertz": 0, "": [0, 6], "librari": 0, "sudo": 0, "apt": 0, "instal": 0, "python3": 0, "opencv": 0, "y": [0, 8], "pip": 0, "zerohertzlib": 0, "import": 0, "zz": [0, 3, 4, 5, 6, 7, 8, 9], "packag": [0, 1], "index": 0, "modul": [0, 1], "search": [0, 4], "page": 0, "subpackag": 1, "algorithm": [1, 2], "api": [1, 2], "log": [1, 2], "mlop": [1, 2], "monitor": [1, 2], "plot": [1, 2], "vision": [1, 2], "content": 1, "soe": 3, "n": [3, 6], "int": [3, 4, 5, 6, 7, 8, 9], "list": [3, 4, 6, 8], "siev": 3, "eratosthen": 3, "paramet": [3, 4, 5, 6, 7, 8, 9], "\uad6c\ud558\uace0\uc790": 3, "\ud558\ub294": 3, "\uc18c\uc218": 3, "\ubc94\uc704\uc758": 3, "\ucd5c\ub313\uac12": 3, "return": [3, 4, 6, 7, 8, 9], "n\uae4c\uc9c0": 3, "\uc874\uc7ac\ud558\ub294": [3, 7, 9], "type": [3, 4, 6, 7, 8, 9], "exampl": [3, 4, 5, 6, 7, 8, 9], "10": [3, 5, 6, 8], "2": [3, 6, 8], "3": [3, 4, 6], "5": [3, 4], "7": [3, 6], "bf": 3, "map": 3, "start": 3, "bfs\ub97c": 3, "\uc218\ud589\ud558\uae30": 3, "\uc704\ud55c": [3, 6], "\ud568\uc218": 3, "\uc785\ub825": [3, 4, 6, 7, 8], "\uadf8\ub798\ud504": 3, "\uadf8\ub798\ud504\uc758": 3, "\uc2dc\uc791": 3, "\uc9c0\uc810": 3, "\ubc29\ubb38": 3, "\uc21c\uc11c": 3, "4": 3, "1": [3, 4, 6, 7, 8], "df": 3, "dfs\ub97c": 3, "fft": 3, "sig": 3, "complex": 3, "inv": 3, "fast": 3, "fourier": 3, "transform": 3, "\ub97c": 3, "\uc2e0\ud638": 3, "\ubcf5\uc18c\uc218": 3, "\ub9ac\uc2a4\ud2b8": 3, "\ubcc0\ud658": [3, 9], "\ubc29\ud5a5\uc744": 3, "\uc9c0\uc815": 3, "0": [3, 8], "\uc815\ubc29\ud5a5": 3, "\uc5ed\ubc29\ud5a5": 3, "\ubcc0\ud658\ub41c": 3, "\uacb0\uacfc": [3, 6], "0j": 3, "api_kei": 4, "str": [4, 5, 6, 7, 8, 9], "openaiobject": 4, "openai\uc758": 4, "\ud0a4": 4, "\ub4f1\ub85d": 4, "\uc704\uc640": 4, "\uac19\uc774": 4, "openai": 4, "\ud398\uc774\uc9c0\uc5d0\uc11c": 4, "\ubc1c\uae09": 4, "\ud6c4": 4, "api\ub97c": 4, "\ub4f1\ub85d\ud574\uc57c": 4, "\uc0ac\uc6a9\ud560": 4, "\uc218": 4, "\uc788\ub2e4": 4, "kei": 4, "\uc0ac\uc6a9": 4, "\uac00\ub2a5\ud55c": 4, "model\ub4e4\uc758": 4, "\uc815\ubcf4": 4, "openai_object": 4, "sk": 4, "json": 4, "object": [4, 5, 6], "data": [4, 8], "id": 4, "text": 4, "babbag": 4, "doc": 4, "001": 4, "model": [4, 6], "creat": 4, "owned_bi": 4, "dev": 4, "gpt": 4, "turbo": 4, "16k": 4, "0613": 4, "messag": 4, "\uc2e4\ud589": 4, "chatgpt": 4, "5\uc758": 4, "\ucd9c\ub825": [4, 6], "hi": 4, "hello": 4, "how": 4, "can": 4, "i": [4, 8], "assist": 4, "you": 4, "todai": 4, "send_discord_messag": 4, "webhook_url": 4, "t": 4, "none": [4, 5, 6, 7, 8, 9], "codeblock": 4, "bool": [4, 8], "fals": 4, "respons": 4, "discord": [4, 5], "webhook\uc5d0": 4, "\uba54\uc138\uc9c0": 4, "\uc804\uc1a1": 4, "webhook\uc758": [4, 5], "url": [4, 5, 6], "\uc758": [4, 5, 8], "\uac04": [4, 9], "\uac04\uaca9": [4, 9], "\uc804\uc1a1\ub418\ub294": 4, "\uba54\uc138\uc9c0\uc758": 4, "\uc2a4\ud0c0\uc77c": 4, "\uc751\ub2f5": 4, "request": 4, "http": 4, "com": 4, "webhook": 4, "test": 4, "204": 4, "class": [5, 6], "logger": 5, "logger_nam": 5, "file_nam": 5, "loggerlevel": 5, "consolelevel": 5, "filelevel": 5, "base": [5, 6], "\uc774\uc058\uac8c": 5, "log\ub97c": 5, "\ucc0d\uc5b4\ubcf4\ub294": 5, "\ub354": 5, "\uc608\ubed0\uc9c0\uace0": 5, "\uc2f6\uc2b5\ub2c8\ub2e4": 5, "option": [5, 6, 7, 8, 9], "logger\uc758": 5, "\uc774\ub984": [5, 6], "\ud30c\uc77c\uc758": 5, "\ubbf8\uc785\ub825": 5, "\uc2dc": [5, 6, 8], "\ubbf8\ucd9c\ub825": 5, "\uc801\uc6a9": 5, "getlogg": 5, "level": 5, "streamhandl": 5, "filehandl": 5, "test_1": 5, "debug": 5, "2023": 5, "11": 5, "07": 5, "21": 5, "41": 5, "36": 5, "505": 5, "info": 5, "warn": 5, "error": 5, "critic": 5, "tritonclientk8": 6, "svc_name": 6, "namespac": 6, "model_nam": 6, "port": 6, "8001": 6, "tritonclienturl": 6, "kubernetes\uc5d0\uc11c": 6, "\uc2e4\ud589\ub418\ub294": 6, "triton": 6, "infer": 6, "server\uc758": 6, "\ud638\ucd9c\uc744": 6, "\ud638\ucd9c\ud560": 6, "kubernet": 6, "service\uc758": 6, "server": 6, "\ub0b4": [6, 9], "model\uc758": 6, "grpc": 6, "\ud1b5\uc2e0": 6, "\ubc88\ud638": 6, "input": 6, "\uc9c0\uc815\ub41c": 6, "dict": [6, 8], "ani": 6, "output": 6, "__call__": 6, "\ud638\ucd9c": 6, "\uc218\ud589": 6, "arg": 6, "\uc0ac\uc6a9\ub420": 6, "self": 6, "\ud638\ucd9c\ub41c": 6, "np": [6, 8], "ndarrai": 6, "kubectl": 6, "get": 6, "svc": 6, "yolo": 6, "name": 6, "cluster": 6, "ip": 6, "extern": 6, "ag": 6, "fastapi": 6, "clusterip": 6, "106": 6, "72": 6, "126": 6, "80": 6, "tcp": 6, "90": 6, "96": 6, "28": 6, "172": 6, "docker": 6, "exec": 6, "api_contain": 6, "bash": 6, "python": 6, "tc": 6, "imag": 6, "data_typ": 6, "type_fp32": 6, "dim": [6, 8], "640": 6, "output0": 6, "25200": 6, "85": 6, "zero": 6, "arrai": 6, "90108061e": 6, "00": 6, "51982164e": 6, "49971962e": 6, "21481919e": 6, "03": 6, "17585063e": 6, "36753917e": 6, "dtype": 6, "float32": 6, "\uc678\ubd80\uc5d0\uc11c": 6, "localhost": 6, "storag": 7, "path": 7, "threshold": 7, "\uc9c0\uc815\ud55c": 7, "\uacbd\ub85c\uc5d0": 7, "\ud30c\uc77c\uc5d0": 7, "\ub530\ub978": [7, 8], "\uc6a9\ub7c9\uc744": 7, "pie": [7, 8], "graph\ub85c": [7, 8], "\uc2dc\uac01\ud654": [7, 8], "\ub370\uc774\ud130": [7, 8], "etc": 7, "\ub85c": 7, "\ubd84\ub958\ub420": 7, "\uc784\uacc4\uac12": 7, "\ub2e8\uc704": [7, 8], "\ud604\uc7ac": [7, 8, 9], "directory\uc5d0": [7, 8, 9], "\ubc14\ub85c": [7, 8, 9], "graph": [7, 8], "\uc800\uc7a5": [7, 8, 9], "bar": 8, "float": 8, "xlab": 8, "\ubcc0\uc218": 8, "ylab": 8, "\ube48\ub3c4": 8, "titl": 8, "tmp": [8, 9], "ratio": 8, "tupl": 8, "15": [8, 9], "dpi": 8, "300": 8, "rot": 8, "per": [8, 9], "true": 8, "dictionary\ub85c": 8, "\uc785\ub825\ubc1b\uc740": 8, "\ub370\uc774\ud130\ub97c": 8, "union": 8, "graph\uc5d0": 8, "\ucd9c\ub825\ub420": [8, 9], "x\ucd95": 8, "label": 8, "y\ucd95": 8, "\ud45c\uc2dc\ub420": 8, "\uc81c\ubaa9": 8, "\ubc0f": 8, "\ud30c\uc77c\uba85": [8, 9], "graph\uc758": 8, "\uac00\ub85c": 8, "\uc138\ub85c": 8, "\uae38\uc774": 8, "dot": 8, "inch": 8, "x\ucd95\uc758": 8, "\ub208\uae08": 8, "\ud68c\uc804": 8, "\uac01\ub3c4": 8, "\uac01": 8, "\uc0c1\ub2e8\uc5d0": 8, "percentag": 8, "\ud45c\uc2dc": 8, "\uc5ec\ubd80": 8, "\ud14c\ub780": 8, "27": 8, "\uc800\uadf8": 8, "40": 8, "\ud504\ub85c\ud1a0\uc2a4": 8, "30": 8, "\uc885\uc871": 8, "\uc778\uad6c": 8, "\uba85": 8, "star": 8, "craft": 8, "barh": 8, "hist": 8, "cnt": 8, "ovp": 8, "histogram\uc73c\ub85c": 8, "bin\uc758": 8, "\uac1c\uc218": 8, "class\uc5d0": 8, "histogram": 8, "overlap": 8, "random": 8, "rand": 8, "1000": 8, "\uc131\uc801": 8, "\uc810": 8, "\uc778\uc6d0": 8, "x": 8, "rang": 8, "20": 8, "\uc2dc\uac04": 8, "\ucd08": 8, "img2gif": 9, "images_path": 9, "output_filenam": 9, "durat": 9, "500": 9, "directori": 9, "\uc774\ubbf8\uc9c0\ub4e4\uc744": 9, "gif\ub85c": 9, "\ubcc0\ud658\ud560": 9, "\uc774\ubbf8\uc9c0\ub4e4\uc774": 9, "\uacbd\ub85c": 9, "gif": 9, "m": 9, "\ub2e8\uc704\uc758": 9, "\uc0ac\uc9c4": 9, "vid2gif": 9, "video_path": 9, "qualiti": 9, "100": 9, "fp": 9, "\ub3d9\uc601\uc0c1\uc744": 9, "\ub3d9\uc601\uc0c1\uc774": 9, "gif\uc758": 9, "\ud488\uc9c8": 9, "frame": 9, "second": 9, "mp4": 9}, "objects": {"": [[2, 0, 0, "-", "zerohertzLib"]], "zerohertzLib": [[3, 0, 0, "-", "algorithm"], [4, 0, 0, "-", "api"], [5, 0, 0, "-", "logging"], [6, 0, 0, "-", "mlops"], [7, 0, 0, "-", "monitoring"], [8, 0, 0, "-", "plot"], [9, 0, 0, "-", "vision"]], "zerohertzLib.algorithm": [[3, 1, 1, "", "SoE"], [3, 1, 1, "", "bfs"], [3, 1, 1, "", "dfs"], [3, 1, 1, "", "fft"]], "zerohertzLib.api": [[4, 1, 1, "", "api_key"], [4, 1, 1, "", "gpt"], [4, 1, 1, "", "send_discord_message"]], "zerohertzLib.logging": [[5, 2, 1, "", "Logger"]], "zerohertzLib.logging.Logger": [[5, 3, 1, "", "critical"], [5, 3, 1, "", "debug"], [5, 3, 1, "", "error"], [5, 3, 1, "", "info"], [5, 3, 1, "", "warning"]], "zerohertzLib.mlops": [[6, 2, 1, "", "tritonClientK8s"], [6, 2, 1, "", "tritonClientURL"]], "zerohertzLib.mlops.tritonClientK8s": [[6, 3, 1, "", "__call__"], [6, 4, 1, "", "inputs"], [6, 4, 1, "", "outputs"]], "zerohertzLib.mlops.tritonClientURL": [[6, 3, 1, "", "__call__"], [6, 4, 1, "", "inputs"], [6, 4, 1, "", "outputs"]], "zerohertzLib.monitoring": [[7, 1, 1, "", "storage"]], "zerohertzLib.plot": [[8, 1, 1, "", "bar"], [8, 1, 1, "", "barh"], [8, 1, 1, "", "hist"], [8, 1, 1, "", "pie"], [8, 1, 1, "", "plot"]], "zerohertzLib.vision": [[9, 1, 1, "", "img2gif"], [9, 1, 1, "", "vid2gif"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:method", "4": "py:attribute"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "method", "Python method"], "4": ["py", "attribute", "Python attribute"]}, "titleterms": {"content": [0, 2, 3, 4, 5, 6, 7, 8, 9], "indic": 0, "tabl": 0, "zerohertzlib": [1, 2, 3, 4, 5, 6, 7, 8, 9], "packag": [2, 3, 4, 5, 6, 7, 8, 9], "subpackag": 2, "modul": [2, 3, 4, 5, 6, 7, 8, 9], "algorithm": 3, "api": 4, "log": 5, "mlop": 6, "monitor": 7, "plot": 8, "vision": 9}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 58}, "alltitles": {"Contents:": [[0, null]], "Indices and tables": [[0, "indices-and-tables"]], "zerohertzLib": [[1, "zerohertzlib"]], "zerohertzLib package": [[2, "zerohertzlib-package"]], "Subpackages": [[2, "subpackages"]], "Module contents": [[2, "module-zerohertzLib"], [3, "module-zerohertzLib.algorithm"], [4, "module-zerohertzLib.api"], [5, "module-zerohertzLib.logging"], [6, "module-zerohertzLib.mlops"], [7, "module-zerohertzLib.monitoring"], [8, "module-zerohertzLib.plot"], [9, "module-zerohertzLib.vision"]], "zerohertzLib.algorithm package": [[3, "zerohertzlib-algorithm-package"]], "zerohertzLib.api package": [[4, "zerohertzlib-api-package"]], "zerohertzLib.logging package": [[5, "zerohertzlib-logging-package"]], "zerohertzLib.mlops package": [[6, "zerohertzlib-mlops-package"]], "zerohertzLib.monitoring package": [[7, "zerohertzlib-monitoring-package"]], "zerohertzLib.plot package": [[8, "zerohertzlib-plot-package"]], "zerohertzLib.vision package": [[9, "zerohertzlib-vision-package"]]}, "indexentries": {"module": [[2, "module-zerohertzLib"], [3, "module-zerohertzLib.algorithm"], [4, "module-zerohertzLib.api"], [5, "module-zerohertzLib.logging"], [6, "module-zerohertzLib.mlops"], [7, "module-zerohertzLib.monitoring"], [8, "module-zerohertzLib.plot"], [9, "module-zerohertzLib.vision"]], "zerohertzlib": [[2, "module-zerohertzLib"]], "soe() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.SoE"]], "bfs() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.bfs"]], "dfs() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.dfs"]], "fft() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.fft"]], "zerohertzlib.algorithm": [[3, "module-zerohertzLib.algorithm"]], "api_key() (in module zerohertzlib.api)": [[4, "zerohertzLib.api.api_key"]], "gpt() (in module zerohertzlib.api)": [[4, "zerohertzLib.api.gpt"]], "send_discord_message() (in module zerohertzlib.api)": [[4, "zerohertzLib.api.send_discord_message"]], "zerohertzlib.api": [[4, "module-zerohertzLib.api"]], "logger (class in zerohertzlib.logging)": [[5, "zerohertzLib.logging.Logger"]], "critical() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.critical"]], "debug() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.debug"]], "error() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.error"]], "info() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.info"]], "warning() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.warning"]], "zerohertzlib.logging": [[5, "module-zerohertzLib.logging"]], "__call__() (zerohertzlib.mlops.tritonclientk8s method)": [[6, "zerohertzLib.mlops.tritonClientK8s.__call__"]], "__call__() (zerohertzlib.mlops.tritonclienturl method)": [[6, "zerohertzLib.mlops.tritonClientURL.__call__"]], "inputs (zerohertzlib.mlops.tritonclientk8s attribute)": [[6, "zerohertzLib.mlops.tritonClientK8s.inputs"]], "inputs (zerohertzlib.mlops.tritonclienturl attribute)": [[6, "zerohertzLib.mlops.tritonClientURL.inputs"]], "outputs (zerohertzlib.mlops.tritonclientk8s attribute)": [[6, "zerohertzLib.mlops.tritonClientK8s.outputs"]], "outputs (zerohertzlib.mlops.tritonclienturl attribute)": [[6, "zerohertzLib.mlops.tritonClientURL.outputs"]], "tritonclientk8s (class in zerohertzlib.mlops)": [[6, "zerohertzLib.mlops.tritonClientK8s"]], "tritonclienturl (class in zerohertzlib.mlops)": [[6, "zerohertzLib.mlops.tritonClientURL"]], "zerohertzlib.mlops": [[6, "module-zerohertzLib.mlops"]], "storage() (in module zerohertzlib.monitoring)": [[7, "zerohertzLib.monitoring.storage"]], "zerohertzlib.monitoring": [[7, "module-zerohertzLib.monitoring"]], "bar() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.bar"]], "barh() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.barh"]], "hist() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.hist"]], "pie() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.pie"]], "plot() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.plot"]], "zerohertzlib.plot": [[8, "module-zerohertzLib.plot"]], "img2gif() (in module zerohertzlib.vision)": [[9, "zerohertzLib.vision.img2gif"]], "vid2gif() (in module zerohertzlib.vision)": [[9, "zerohertzLib.vision.vid2gif"]], "zerohertzlib.vision": [[9, "module-zerohertzLib.vision"]]}}) \ No newline at end of file +Search.setIndex({"docnames": ["index", "modules", "zerohertzLib", "zerohertzLib.algorithm", "zerohertzLib.api", "zerohertzLib.logging", "zerohertzLib.mlops", "zerohertzLib.monitoring", "zerohertzLib.plot", "zerohertzLib.vision"], "filenames": ["index.rst", "modules.rst", "zerohertzLib.rst", "zerohertzLib.algorithm.rst", "zerohertzLib.api.rst", "zerohertzLib.logging.rst", "zerohertzLib.mlops.rst", "zerohertzLib.monitoring.rst", "zerohertzLib.plot.rst", "zerohertzLib.vision.rst"], "titles": ["Indices and tables", "zerohertzLib", "zerohertzLib package", "zerohertzLib.algorithm package", "zerohertzLib.api package", "zerohertzLib.logging package", "zerohertzLib.mlops package", "zerohertzLib.monitoring package", "zerohertzLib.plot package", "zerohertzLib.vision package"], "terms": {"zerohertz": 0, "": [0, 6], "librari": 0, "sudo": 0, "apt": 0, "instal": 0, "python3": 0, "opencv": 0, "y": [0, 8], "pip": 0, "zerohertzlib": 0, "import": 0, "zz": [0, 3, 4, 5, 6, 7, 8, 9], "packag": [0, 1], "index": 0, "modul": [0, 1], "search": [0, 4], "page": 0, "subpackag": 1, "algorithm": [1, 2], "api": [1, 2], "log": [1, 2], "mlop": [1, 2], "monitor": [1, 2], "plot": [1, 2], "vision": [1, 2], "content": 1, "soe": 3, "n": [3, 6], "int": [3, 4, 5, 6, 7, 8, 9], "list": [3, 4, 6, 8, 9], "siev": 3, "eratosthen": 3, "paramet": [3, 4, 5, 6, 7, 8, 9], "\uad6c\ud558\uace0\uc790": 3, "\ud558\ub294": 3, "\uc18c\uc218": 3, "\ubc94\uc704\uc758": 3, "\ucd5c\ub313\uac12": 3, "return": [3, 4, 6, 7, 8, 9], "n\uae4c\uc9c0": 3, "\uc874\uc7ac\ud558\ub294": [3, 7, 9], "type": [3, 4, 6, 7, 8, 9], "exampl": [3, 4, 5, 6, 7, 8, 9], "10": [3, 5, 6, 8, 9], "2": [3, 6, 8, 9], "3": [3, 4, 6, 8], "5": [3, 4, 8], "7": [3, 6], "bf": 3, "map": 3, "start": 3, "bfs\ub97c": 3, "\uc218\ud589\ud558\uae30": 3, "\uc704\ud55c": [3, 6], "\ud568\uc218": 3, "\uc785\ub825": [3, 4, 6, 7, 8, 9], "\uadf8\ub798\ud504": 3, "\uadf8\ub798\ud504\uc758": 3, "\uc2dc\uc791": 3, "\uc9c0\uc810": 3, "\ubc29\ubb38": 3, "\uc21c\uc11c": 3, "4": 3, "1": [3, 4, 6, 7, 8], "df": 3, "dfs\ub97c": 3, "fft": 3, "sig": 3, "complex": 3, "inv": 3, "fast": 3, "fourier": 3, "transform": 3, "\ub97c": 3, "\uc2e0\ud638": 3, "\ubcf5\uc18c\uc218": 3, "\ub9ac\uc2a4\ud2b8": 3, "\ubcc0\ud658": [3, 9], "\ubc29\ud5a5\uc744": 3, "\uc9c0\uc815": 3, "0": [3, 8, 9], "\uc815\ubc29\ud5a5": 3, "\uc5ed\ubc29\ud5a5": 3, "\ubcc0\ud658\ub41c": 3, "\uacb0\uacfc": [3, 6], "0j": 3, "api_kei": 4, "str": [4, 5, 6, 7, 8, 9], "openaiobject": 4, "openai\uc758": 4, "\ud0a4": 4, "\ub4f1\ub85d": 4, "\uc704\uc640": 4, "\uac19\uc774": 4, "openai": 4, "\ud398\uc774\uc9c0\uc5d0\uc11c": 4, "\ubc1c\uae09": 4, "\ud6c4": [4, 9], "api\ub97c": 4, "\ub4f1\ub85d\ud574\uc57c": 4, "\uc0ac\uc6a9\ud560": 4, "\uc218": 4, "\uc788\ub2e4": 4, "kei": 4, "\uc0ac\uc6a9": 4, "\uac00\ub2a5\ud55c": 4, "model\ub4e4\uc758": 4, "\uc815\ubcf4": 4, "openai_object": 4, "sk": 4, "json": 4, "object": [4, 5, 6], "data": [4, 8], "id": 4, "text": 4, "babbag": 4, "doc": 4, "001": 4, "model": [4, 6], "creat": 4, "owned_bi": 4, "dev": 4, "gpt": 4, "turbo": 4, "16k": 4, "0613": 4, "messag": 4, "\uc2e4\ud589": 4, "chatgpt": 4, "5\uc758": 4, "\ucd9c\ub825": [4, 6, 9], "hi": 4, "hello": 4, "how": 4, "can": 4, "i": [4, 8], "assist": 4, "you": 4, "todai": 4, "send_discord_messag": 4, "webhook_url": 4, "t": 4, "none": [4, 5, 6, 7, 8, 9], "codeblock": 4, "bool": [4, 8, 9], "fals": 4, "respons": 4, "discord": [4, 5], "webhook\uc5d0": 4, "\uba54\uc138\uc9c0": 4, "\uc804\uc1a1": 4, "webhook\uc758": [4, 5], "url": [4, 5, 6], "\uc758": [4, 5, 8, 9], "\uac04": [4, 9], "\uac04\uaca9": [4, 9], "\uc804\uc1a1\ub418\ub294": 4, "\uba54\uc138\uc9c0\uc758": 4, "\uc2a4\ud0c0\uc77c": 4, "\uc751\ub2f5": 4, "request": 4, "http": 4, "com": 4, "webhook": 4, "test": [4, 9], "204": 4, "class": [5, 6], "logger": 5, "logger_nam": 5, "file_nam": 5, "loggerlevel": 5, "consolelevel": 5, "filelevel": 5, "base": [5, 6], "\uc774\uc058\uac8c": 5, "log\ub97c": 5, "\ucc0d\uc5b4\ubcf4\ub294": 5, "\ub354": 5, "\uc608\ubed0\uc9c0\uace0": 5, "\uc2f6\uc2b5\ub2c8\ub2e4": 5, "option": [5, 6, 7, 8, 9], "logger\uc758": 5, "\uc774\ub984": [5, 6, 9], "\ud30c\uc77c\uc758": [5, 9], "\ubbf8\uc785\ub825": 5, "\uc2dc": [5, 6, 8], "\ubbf8\ucd9c\ub825": 5, "\uc801\uc6a9": 5, "getlogg": 5, "level": 5, "streamhandl": 5, "filehandl": 5, "test_1": 5, "debug": 5, "2023": 5, "11": 5, "07": 5, "21": 5, "41": 5, "36": [5, 8], "505": 5, "info": 5, "warn": 5, "error": 5, "critic": 5, "tritonclientk8": 6, "svc_name": 6, "namespac": 6, "model_nam": 6, "port": 6, "8001": 6, "tritonclienturl": 6, "kubernetes\uc5d0\uc11c": 6, "\uc2e4\ud589\ub418\ub294": 6, "triton": 6, "infer": 6, "server\uc758": 6, "\ud638\ucd9c\uc744": 6, "\ud638\ucd9c\ud560": 6, "kubernet": 6, "service\uc758": 6, "server": 6, "\ub0b4": [6, 8, 9], "model\uc758": 6, "grpc": 6, "\ud1b5\uc2e0": 6, "\ubc88\ud638": 6, "input": 6, "\uc9c0\uc815\ub41c": 6, "dict": [6, 8], "ani": 6, "output": 6, "__call__": 6, "\ud638\ucd9c": 6, "\uc218\ud589": 6, "arg": 6, "\uc0ac\uc6a9\ub420": 6, "self": 6, "\ud638\ucd9c\ub41c": 6, "np": [6, 8, 9], "ndarrai": [6, 9], "kubectl": 6, "get": 6, "svc": 6, "yolo": 6, "name": 6, "cluster": 6, "ip": 6, "extern": 6, "ag": 6, "fastapi": 6, "clusterip": 6, "106": 6, "72": 6, "126": 6, "80": 6, "tcp": 6, "90": 6, "96": 6, "28": 6, "172": 6, "docker": 6, "exec": 6, "api_contain": 6, "bash": 6, "python": 6, "tc": 6, "imag": 6, "data_typ": 6, "type_fp32": 6, "dim": [6, 8], "640": 6, "output0": 6, "25200": 6, "85": 6, "zero": 6, "arrai": [6, 9], "90108061e": 6, "00": 6, "51982164e": 6, "49971962e": 6, "21481919e": 6, "03": 6, "17585063e": 6, "36753917e": 6, "dtype": 6, "float32": 6, "\uc678\ubd80\uc5d0\uc11c": 6, "localhost": 6, "storag": 7, "path": 7, "threshold": 7, "\uc9c0\uc815\ud55c": 7, "\uacbd\ub85c\uc5d0": 7, "\ud30c\uc77c\uc5d0": 7, "\ub530\ub978": [7, 8], "\uc6a9\ub7c9\uc744": 7, "pie": [7, 8], "graph\ub85c": 7, "\uc2dc\uac01\ud654": [7, 8], "\ub370\uc774\ud130": [7, 8], "etc": 7, "\ub85c": 7, "\ubd84\ub958\ub420": 7, "\uc784\uacc4\uac12": 7, "\ub2e8\uc704": [7, 8, 9], "\ud604\uc7ac": [7, 8, 9], "directory\uc5d0": [7, 8, 9], "\ubc14\ub85c": [7, 8, 9], "graph": [7, 8], "\uc800\uc7a5": [7, 8, 9], "bar": 8, "float": [8, 9], "xlab": 8, "\ubcc0\uc218": 8, "ylab": 8, "\ube48\ub3c4": 8, "titl": 8, "tmp": [8, 9], "ratio": 8, "tupl": 8, "15": [8, 9], "dpi": 8, "300": 8, "rot": 8, "per": [8, 9], "true": [8, 9], "dictionary\ub85c": 8, "\uc785\ub825\ubc1b\uc740": 8, "\ub370\uc774\ud130\ub97c": 8, "\uac00\ub85c": 8, "chart\ub85c": 8, "union": [8, 9], "graph\uc5d0": 8, "\ucd9c\ub825\ub420": [8, 9], "x\ucd95": 8, "label": 8, "y\ucd95": 8, "\ud45c\uc2dc\ub420": 8, "\uc81c\ubaa9": 8, "\ubc0f": 8, "\ud30c\uc77c\uba85": [8, 9], "graph\uc758": 8, "\uc138\ub85c": 8, "\uae38\uc774": 8, "dot": 8, "inch": 8, "x\ucd95\uc758": 8, "\ub208\uae08": 8, "\ud68c\uc804": 8, "\uac01\ub3c4": 8, "\uac01": 8, "\uc0c1\ub2e8\uc5d0": 8, "percentag": 8, "\ud45c\uc2dc": 8, "\uc5ec\ubd80": [8, 9], "\ud14c\ub780": 8, "27": 8, "\uc800\uadf8": 8, "40": [8, 9], "\ud504\ub85c\ud1a0\uc2a4": 8, "30": [8, 9], "\uc885\uc871": 8, "\uc778\uad6c": 8, "\uba85": 8, "star": 8, "craft": 8, "barh": 8, "hist": 8, "cnt": 8, "ovp": 8, "histogram\uc73c\ub85c": 8, "bin\uc758": 8, "\uac1c\uc218": 8, "class\uc5d0": 8, "histogram": 8, "overlap": 8, "random": [8, 9], "rand": [8, 9], "1000": [8, 9], "\uc131\uc801": 8, "\uc810": 8, "\uc778\uc6d0": 8, "int_label": 8, "\uc218\uce58\uc758": 8, "\uc18c\uc218\uc810": 8, "\ud45c\uae30": 8, "x": 8, "list\uc640": 8, "line": 8, "rang": [8, 9], "20": [8, 9], "\uc2dc\uac04": 8, "\ucd08": 8, "scatter": 8, "size": [8, 9], "plot\uc73c\ub85c": 8, "marker\uc758": 8, "\ud06c\uae30": [8, 9], "200": 8, "400": 8, "\ube44\uc6a9": 8, "\ubbf8\ub124\ub784": 8, "\uc804\ud22c\ub825": 8, "before_aft": 9, "befor": 9, "after": 9, "area": 9, "100": 9, "qualiti": 9, "output_filenam": 9, "\ub450": 9, "\uc774\ubbf8\uc9c0\ub97c": 9, "\ube44\uad50\ud558\ub294": 9, "\uc774\ubbf8\uc9c0": 9, "\uc0dd\uc131": 9, "\uc6d0\ubcf8": 9, "\uc601\uc0c1": 9, "\ucc98\ub9ac": 9, "\ud639\uc740": 9, "\ubaa8\ub378": 9, "\ucd94\ub860": 9, "\ube44\uad50\ud560": 9, "\uc88c\ud45c": 9, "x1": 9, "x2": 9, "y1": 9, "y2": 9, "\ubc31\ubd84\uc728": 9, "\uc774\ubbf8\uc9c0\uc758": 9, "\uc800\uc7a5\ub420": 9, "bgr": 9, "grai": 9, "cv2": 9, "imread": 9, "jpg": 9, "gaussianblur": 9, "25": 9, "cvtcolor": 9, "color_bgr2grai": 9, "resiz": 9, "60": 9, "grid": 9, "img": 9, "\uc5ec\ub7ec": 9, "\uc785\ub825\ubc1b\uc544": 9, "\ud55c": 9, "\uc774\ubbf8\uc9c0\ub85c": 9, "\ubcd1\ud569": 9, "shape": 9, "astyp": 9, "uint8": 9, "_": 9, "8": 9, "img2gif": 9, "images_path": 9, "durat": 9, "500": 9, "directori": 9, "\uc774\ubbf8\uc9c0\ub4e4\uc744": 9, "gif\ub85c": 9, "\ubcc0\ud658\ud560": 9, "\uc774\ubbf8\uc9c0\ub4e4\uc774": 9, "\uacbd\ub85c": 9, "gif": 9, "m": 9, "\ub2e8\uc704\uc758": 9, "\uc0ac\uc9c4": 9, "vid2gif": 9, "video_path": 9, "fp": 9, "\ub3d9\uc601\uc0c1\uc744": 9, "\ub3d9\uc601\uc0c1\uc774": 9, "gif\uc758": 9, "\ud488\uc9c8": 9, "frame": 9, "second": 9, "mp4": 9}, "objects": {"": [[2, 0, 0, "-", "zerohertzLib"]], "zerohertzLib": [[3, 0, 0, "-", "algorithm"], [4, 0, 0, "-", "api"], [5, 0, 0, "-", "logging"], [6, 0, 0, "-", "mlops"], [7, 0, 0, "-", "monitoring"], [8, 0, 0, "-", "plot"], [9, 0, 0, "-", "vision"]], "zerohertzLib.algorithm": [[3, 1, 1, "", "SoE"], [3, 1, 1, "", "bfs"], [3, 1, 1, "", "dfs"], [3, 1, 1, "", "fft"]], "zerohertzLib.api": [[4, 1, 1, "", "api_key"], [4, 1, 1, "", "gpt"], [4, 1, 1, "", "send_discord_message"]], "zerohertzLib.logging": [[5, 2, 1, "", "Logger"]], "zerohertzLib.logging.Logger": [[5, 3, 1, "", "critical"], [5, 3, 1, "", "debug"], [5, 3, 1, "", "error"], [5, 3, 1, "", "info"], [5, 3, 1, "", "warning"]], "zerohertzLib.mlops": [[6, 2, 1, "", "tritonClientK8s"], [6, 2, 1, "", "tritonClientURL"]], "zerohertzLib.mlops.tritonClientK8s": [[6, 3, 1, "", "__call__"], [6, 4, 1, "", "inputs"], [6, 4, 1, "", "outputs"]], "zerohertzLib.mlops.tritonClientURL": [[6, 3, 1, "", "__call__"], [6, 4, 1, "", "inputs"], [6, 4, 1, "", "outputs"]], "zerohertzLib.monitoring": [[7, 1, 1, "", "storage"]], "zerohertzLib.plot": [[8, 1, 1, "", "bar"], [8, 1, 1, "", "barh"], [8, 1, 1, "", "hist"], [8, 1, 1, "", "pie"], [8, 1, 1, "", "plot"], [8, 1, 1, "", "scatter"]], "zerohertzLib.vision": [[9, 1, 1, "", "before_after"], [9, 1, 1, "", "grid"], [9, 1, 1, "", "img2gif"], [9, 1, 1, "", "vid2gif"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:method", "4": "py:attribute"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "method", "Python method"], "4": ["py", "attribute", "Python attribute"]}, "titleterms": {"content": [0, 2, 3, 4, 5, 6, 7, 8, 9], "indic": 0, "tabl": 0, "zerohertzlib": [1, 2, 3, 4, 5, 6, 7, 8, 9], "packag": [2, 3, 4, 5, 6, 7, 8, 9], "subpackag": 2, "modul": [2, 3, 4, 5, 6, 7, 8, 9], "algorithm": 3, "api": 4, "log": 5, "mlop": 6, "monitor": 7, "plot": 8, "vision": 9}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 58}, "alltitles": {"Contents:": [[0, null]], "Indices and tables": [[0, "indices-and-tables"]], "zerohertzLib": [[1, "zerohertzlib"]], "zerohertzLib package": [[2, "zerohertzlib-package"]], "Subpackages": [[2, "subpackages"]], "Module contents": [[2, "module-zerohertzLib"], [3, "module-zerohertzLib.algorithm"], [4, "module-zerohertzLib.api"], [5, "module-zerohertzLib.logging"], [6, "module-zerohertzLib.mlops"], [7, "module-zerohertzLib.monitoring"], [8, "module-zerohertzLib.plot"], [9, "module-zerohertzLib.vision"]], "zerohertzLib.algorithm package": [[3, "zerohertzlib-algorithm-package"]], "zerohertzLib.api package": [[4, "zerohertzlib-api-package"]], "zerohertzLib.logging package": [[5, "zerohertzlib-logging-package"]], "zerohertzLib.mlops package": [[6, "zerohertzlib-mlops-package"]], "zerohertzLib.monitoring package": [[7, "zerohertzlib-monitoring-package"]], "zerohertzLib.plot package": [[8, "zerohertzlib-plot-package"]], "zerohertzLib.vision package": [[9, "zerohertzlib-vision-package"]]}, "indexentries": {"module": [[2, "module-zerohertzLib"], [3, "module-zerohertzLib.algorithm"], [4, "module-zerohertzLib.api"], [5, "module-zerohertzLib.logging"], [6, "module-zerohertzLib.mlops"], [7, "module-zerohertzLib.monitoring"], [8, "module-zerohertzLib.plot"], [9, "module-zerohertzLib.vision"]], "zerohertzlib": [[2, "module-zerohertzLib"]], "soe() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.SoE"]], "bfs() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.bfs"]], "dfs() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.dfs"]], "fft() (in module zerohertzlib.algorithm)": [[3, "zerohertzLib.algorithm.fft"]], "zerohertzlib.algorithm": [[3, "module-zerohertzLib.algorithm"]], "api_key() (in module zerohertzlib.api)": [[4, "zerohertzLib.api.api_key"]], "gpt() (in module zerohertzlib.api)": [[4, "zerohertzLib.api.gpt"]], "send_discord_message() (in module zerohertzlib.api)": [[4, "zerohertzLib.api.send_discord_message"]], "zerohertzlib.api": [[4, "module-zerohertzLib.api"]], "logger (class in zerohertzlib.logging)": [[5, "zerohertzLib.logging.Logger"]], "critical() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.critical"]], "debug() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.debug"]], "error() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.error"]], "info() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.info"]], "warning() (zerohertzlib.logging.logger method)": [[5, "zerohertzLib.logging.Logger.warning"]], "zerohertzlib.logging": [[5, "module-zerohertzLib.logging"]], "__call__() (zerohertzlib.mlops.tritonclientk8s method)": [[6, "zerohertzLib.mlops.tritonClientK8s.__call__"]], "__call__() (zerohertzlib.mlops.tritonclienturl method)": [[6, "zerohertzLib.mlops.tritonClientURL.__call__"]], "inputs (zerohertzlib.mlops.tritonclientk8s attribute)": [[6, "zerohertzLib.mlops.tritonClientK8s.inputs"]], "inputs (zerohertzlib.mlops.tritonclienturl attribute)": [[6, "zerohertzLib.mlops.tritonClientURL.inputs"]], "outputs (zerohertzlib.mlops.tritonclientk8s attribute)": [[6, "zerohertzLib.mlops.tritonClientK8s.outputs"]], "outputs (zerohertzlib.mlops.tritonclienturl attribute)": [[6, "zerohertzLib.mlops.tritonClientURL.outputs"]], "tritonclientk8s (class in zerohertzlib.mlops)": [[6, "zerohertzLib.mlops.tritonClientK8s"]], "tritonclienturl (class in zerohertzlib.mlops)": [[6, "zerohertzLib.mlops.tritonClientURL"]], "zerohertzlib.mlops": [[6, "module-zerohertzLib.mlops"]], "storage() (in module zerohertzlib.monitoring)": [[7, "zerohertzLib.monitoring.storage"]], "zerohertzlib.monitoring": [[7, "module-zerohertzLib.monitoring"]], "bar() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.bar"]], "barh() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.barh"]], "hist() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.hist"]], "pie() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.pie"]], "plot() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.plot"]], "scatter() (in module zerohertzlib.plot)": [[8, "zerohertzLib.plot.scatter"]], "zerohertzlib.plot": [[8, "module-zerohertzLib.plot"]], "before_after() (in module zerohertzlib.vision)": [[9, "zerohertzLib.vision.before_after"]], "grid() (in module zerohertzlib.vision)": [[9, "zerohertzLib.vision.grid"]], "img2gif() (in module zerohertzlib.vision)": [[9, "zerohertzLib.vision.img2gif"]], "vid2gif() (in module zerohertzlib.vision)": [[9, "zerohertzLib.vision.vid2gif"]], "zerohertzlib.vision": [[9, "module-zerohertzLib.vision"]]}}) \ No newline at end of file diff --git a/docs/zerohertzLib.algorithm.html b/docs/zerohertzLib.algorithm.html index 421a99f6..a36de2eb 100644 --- a/docs/zerohertzLib.algorithm.html +++ b/docs/zerohertzLib.algorithm.html @@ -4,14 +4,14 @@ - zerohertzLib.algorithm package — zerohertzLib v0.1.9 documentation + zerohertzLib.algorithm package — zerohertzLib v0.1.10 documentation - + diff --git a/docs/zerohertzLib.api.html b/docs/zerohertzLib.api.html index c72c56c7..29bf0329 100644 --- a/docs/zerohertzLib.api.html +++ b/docs/zerohertzLib.api.html @@ -4,14 +4,14 @@ - zerohertzLib.api package — zerohertzLib v0.1.9 documentation + zerohertzLib.api package — zerohertzLib v0.1.10 documentation - + diff --git a/docs/zerohertzLib.html b/docs/zerohertzLib.html index 1463e905..9d8a200c 100644 --- a/docs/zerohertzLib.html +++ b/docs/zerohertzLib.html @@ -4,14 +4,14 @@ - zerohertzLib package — zerohertzLib v0.1.9 documentation + zerohertzLib package — zerohertzLib v0.1.10 documentation - + diff --git a/docs/zerohertzLib.logging.html b/docs/zerohertzLib.logging.html index 07b04b2a..0061822e 100644 --- a/docs/zerohertzLib.logging.html +++ b/docs/zerohertzLib.logging.html @@ -4,14 +4,14 @@ - zerohertzLib.logging package — zerohertzLib v0.1.9 documentation + zerohertzLib.logging package — zerohertzLib v0.1.10 documentation - + diff --git a/docs/zerohertzLib.mlops.html b/docs/zerohertzLib.mlops.html index 9caeeb28..0b870918 100644 --- a/docs/zerohertzLib.mlops.html +++ b/docs/zerohertzLib.mlops.html @@ -4,14 +4,14 @@ - zerohertzLib.mlops package — zerohertzLib v0.1.9 documentation + zerohertzLib.mlops package — zerohertzLib v0.1.10 documentation - + diff --git a/docs/zerohertzLib.monitoring.html b/docs/zerohertzLib.monitoring.html index ce8a6675..2931fd76 100644 --- a/docs/zerohertzLib.monitoring.html +++ b/docs/zerohertzLib.monitoring.html @@ -4,14 +4,14 @@ - zerohertzLib.monitoring package — zerohertzLib v0.1.9 documentation + zerohertzLib.monitoring package — zerohertzLib v0.1.10 documentation - + diff --git a/docs/zerohertzLib.plot.html b/docs/zerohertzLib.plot.html index 7b85f84d..1019026b 100644 --- a/docs/zerohertzLib.plot.html +++ b/docs/zerohertzLib.plot.html @@ -4,14 +4,14 @@ - zerohertzLib.plot package — zerohertzLib v0.1.9 documentation + zerohertzLib.plot package — zerohertzLib v0.1.10 documentation - + @@ -94,7 +94,7 @@

    zerohertzLib.plot package
    zerohertzLib.plot.bar(data: Dict[str, int | float], xlab: str | None = '변수 [단위]', ylab: str | None = '빈도 [단위]', title: str | None = 'tmp', ratio: Tuple[int] | None = (15, 10), dpi: int | None = 300, rot: int | None = 0, per: bool | None = True) None
    -

    Dictionary로 입력받은 데이터를 bar graph로 시각화

    +

    Dictionary로 입력받은 데이터를 가로 bar chart로 시각화

    Visualzation Result
    Parameters:
    @@ -125,7 +125,7 @@

    zerohertzLib.plot package
    zerohertzLib.plot.barh(data: Dict[str, int | float], xlab: str | None = '빈도 [단위]', ylab: str | None = '변수 [단위]', title: str | None = 'tmp', ratio: Tuple[int] | None = (10, 15), dpi: int | None = 300, rot: int | None = 0, per: bool | None = True) None
    -

    Dictionary로 입력받은 데이터를 세로 bar graph로 시각화

    +

    Dictionary로 입력받은 데이터를 세로 bar chart로 시각화

    Visualzation Result
    Parameters:
    @@ -186,8 +186,8 @@

    zerohertzLib.plot package
    -zerohertzLib.plot.pie(data: Dict[str, int | float], dim: str | None = '', title: str | None = 'tmp', ratio: Tuple[int] | None = (15, 10), dpi: int | None = 300) None
    -

    Dictionary로 입력받은 데이터를 pie graph로 시각화

    +zerohertzLib.plot.pie(data: Dict[str, int | float], dim: str | None = '', title: str | None = 'tmp', ratio: Tuple[int] | None = (15, 10), dpi: int | None = 300, int_label: bool | None = True) None +

    Dictionary로 입력받은 데이터를 pie chart로 시각화

    Visualzation Result
    Parameters:
    @@ -197,6 +197,7 @@

    zerohertzLib.plot packageOptional[str]) – Graph에 표시될 제목 및 파일명

  • ratio (Optional[Tuple[int]]) – Graph의 가로, 세로 길이

  • dpi – (Optional[int]): Graph 저장 시 DPI (Dots Per Inch)

  • +
  • int_label – (Optional[bool]): Label 내 수치의 소수점 표기 여부

  • Returns:
    @@ -215,7 +216,7 @@

    zerohertzLib.plot package
    zerohertzLib.plot.plot(x: List[int | float], y: Dict[str, List[int | float]], xlab: str | None = 'x축 [단위]', ylab: str | None = 'y축 [단위]', title: str | None = 'tmp', ratio: Tuple[int] | None = (15, 10), dpi: int | None = 300) None
    -

    Dictionary로 입력받은 데이터를 bar graph로 시각화

    +

    List와 Dictionary로 입력받은 데이터를 line chart로 시각화

    Visualzation Result
    Parameters:
    @@ -242,6 +243,36 @@

    zerohertzLib.plot package +
    +zerohertzLib.plot.scatter(data: Dict[str, List[List[int | float]]], size: float | None = 36, xlab: str | None = 'x축 [단위]', ylab: str | None = 'y축 [단위]', title: str | None = 'tmp', ratio: Tuple[int] | None = (15, 10), dpi: int | None = 300) None
    +

    Dictionary로 입력받은 데이터를 scatter plot으로 시각화

    +Visualzation Result +
    +
    Parameters:
    +
      +
    • data (Dict[str, List[List[Union[int, float]]]]) – 입력 데이터

    • +
    • size (Optional[int]) – Graph에 출력될 marker의 크기

    • +
    • xlab (Optional[str]) – Graph에 출력될 X축 label

    • +
    • ylab (Optional[str]) – Graph에 출력될 Y축 label

    • +
    • title (Optional[str]) – Graph에 표시될 제목 및 파일명

    • +
    • ratio (Optional[Tuple[int]]) – Graph의 가로, 세로 길이

    • +
    • dpi – (Optional[int]): Graph 저장 시 DPI (Dots Per Inch)

    • +
    +
    +
    Returns:
    +

    현재 directory에 바로 graph 저장

    +
    +
    Return type:
    +

    None

    +
    +
    +

    Examples

    +
    >>> zz.plot.scatter({"테란": [list(np.random.rand(200) * 10), list(np.random.rand(200) * 10)], "저그": [list(np.random.rand(200) * 5 - 1), list(np.random.rand(200) * 5 + 1)], "프로토스": [list(np.random.rand(200) * 10 + 3), list(np.random.rand(200) * 10 - 2)]}, size=400, xlab="비용 [미네랄]", ylab="전투력 [점]", title="Star Craft")
    +
    +
    +

    + diff --git a/docs/zerohertzLib.vision.html b/docs/zerohertzLib.vision.html index 2bd70e0f..ec824d26 100644 --- a/docs/zerohertzLib.vision.html +++ b/docs/zerohertzLib.vision.html @@ -4,14 +4,14 @@ - zerohertzLib.vision package — zerohertzLib v0.1.9 documentation + zerohertzLib.vision package — zerohertzLib v0.1.10 documentation - + @@ -90,6 +90,74 @@

    zerohertzLib.vision package

    Module contents

    +
    +
    +zerohertzLib.vision.before_after(before: ndarray, after: ndarray, area: List[int | float] | None = [0.0, 100.0, 0.0, 100.0], per: bool | None = True, quality: int | None = 100, output_filename: str | None = 'tmp') None
    +

    두 이미지를 비교하는 이미지 생성

    +Result +
    +
    Parameters:
    +
      +
    • before (np.ndarray) – 원본 이미지

    • +
    • after (np.ndarray) – 영상 처리 혹은 모델 추론 후 이미지

    • +
    • area – (Optional[List[Union[int, float]]]): 비교할 좌표 ([x1, x2, y1, y2])

    • +
    • per (Optional[bool]) – area 의 백분율 여부

    • +
    • quality (Optional[int]) – 출력 이미지의 quality (단위: %)

    • +
    • output_filename – (Optional[str]): 저장될 파일의 이름

    • +
    +
    +
    Returns:
    +

    현재 directory에 바로 이미지 저장

    +
    +
    Return type:
    +

    None

    +
    +
    +

    Examples

    +

    BGR, GRAY:

    +
    >>> before = cv2.imread("test.jpg")
    +>>> after = cv2.GaussianBlur(before, (0, 0), 25)
    +>>> after = cv2.cvtColor(after, cv2.COLOR_BGR2GRAY)
    +>>> zz.vision.before_after(before, after, quality=10)
    +
    +
    +

    BGR, Resize:

    +
    >>> before = cv2.imread("test.jpg")
    +>>> after = cv2.resize(before, (100, 100))
    +>>> zz.vision.before_after(before, after, [20, 40, 30, 60])
    +
    +
    +
    + +
    +
    +zerohertzLib.vision.grid(*imgs: List[array], size: int = 1000, output_filename: str | None = 'tmp')
    +

    여러 이미지를 입력받아 한 이미지로 병합

    +Result +
    +
    Parameters:
    +
      +
    • *imgs (List[np.array]) – 입력 이미지

    • +
    • size – (int): 출력 이미지의 크기

    • +
    • output_filename – (Optional[str]): 저장될 파일의 이름

    • +
    +
    +
    Returns:
    +

    현재 directory에 바로 이미지 저장

    +
    +
    Return type:
    +

    None

    +
    +
    +

    Examples

    +
    >>> tmp = cv2.imread("test.jpg")
    +>>> imgs = [(tmp + np.random.rand(*tmp.shape)).astype(np.uint8) for _ in range(8)]
    +>>> imgs[2] = cv2.cvtColor(imgs[2], cv2.COLOR_BGR2GRAY)
    +>>> zz.vision.grid(*imgs)
    +
    +
    +
    +
    zerohertzLib.vision.img2gif(images_path: str, output_filename: str | None = 'tmp', duration: int | None = 500) None
    diff --git a/sphinx/source/zerohertzLib.monitoring.rst b/sphinx/source/zerohertzLib.monitoring.rst index 1a7b0778..12e4b767 100644 --- a/sphinx/source/zerohertzLib.monitoring.rst +++ b/sphinx/source/zerohertzLib.monitoring.rst @@ -1,5 +1,5 @@ zerohertzLib.monitoring package -============================== +================================= Module contents --------------- diff --git a/test/test.jpg b/test/test.jpg new file mode 100644 index 00000000..31e8128c Binary files /dev/null and b/test/test.jpg differ diff --git a/test/test_plot.py b/test/test_plot.py index e3f5f312..f7f8e878 100644 --- a/test/test_plot.py +++ b/test/test_plot.py @@ -52,3 +52,24 @@ def test_plot(): title="Star Craft (plot)", ) assert "star_craft_(plot).png" in os.listdir() + + +def test_scatter(): + zz.plot.scatter( + { + "테란": [list(np.random.rand(200) * 10), list(np.random.rand(200) * 10)], + "저그": [ + list(np.random.rand(200) * 5 - 1), + list(np.random.rand(200) * 5 + 1), + ], + "프로토스": [ + list(np.random.rand(200) * 10 + 3), + list(np.random.rand(200) * 10 - 2), + ], + }, + size=400, + xlab="비용 [미네랄]", + ylab="전투력 [점]", + title="Star Craft (scatter)", + ) + assert "star_craft_(scatter).png" in os.listdir() diff --git a/test/test_vision.py b/test/test_vision.py index 5cc842f7..7d2ef2dc 100644 --- a/test/test_vision.py +++ b/test/test_vision.py @@ -19,3 +19,23 @@ def test_img2gif(): def test_vid2gif(): zz.vision.vid2gif(f"{tmp}test.mov", "vid", quality=20) assert "vid.gif" in os.listdir() + + +def test_before_after(): + before = cv2.imread(f"{tmp}test.jpg") + after = cv2.GaussianBlur(before, (0, 0), 25) + after = cv2.cvtColor(after, cv2.COLOR_BGR2GRAY) + zz.vision.before_after(before, after, quality=10, output_filename="ba1") + assert "ba1.png" in os.listdir() + before = cv2.imread(f"{tmp}test.jpg") + after = cv2.resize(before, (100, 100)) + zz.vision.before_after(before, after, [20, 40, 30, 60], output_filename="ba2") + assert "ba2.png" in os.listdir() + + +def test_grid(): + test = cv2.imread(f"{tmp}test.jpg") + imgs = [(test + np.random.rand(*test.shape)).astype(np.uint8) for _ in range(8)] + imgs[2] = cv2.cvtColor(imgs[2], cv2.COLOR_BGR2GRAY) + zz.vision.grid(*imgs, output_filename="grid") + assert "grid.png" in os.listdir() diff --git a/zerohertzLib/__init__.py b/zerohertzLib/__init__.py index 0bf41762..57e255ec 100644 --- a/zerohertzLib/__init__.py +++ b/zerohertzLib/__init__.py @@ -1,3 +1,13 @@ -from zerohertzLib import algorithm, api, logging, mlops, monitoring, plot, vision +from zerohertzLib import algorithm, api, logging, mlops, monitoring, plot -__version__ = "v0.1.9" +try: + from zerohertzLib import vision +except ImportError as e: + print("=" * 100) + print(f"[Warning] {e}") + print("Please Install OpenCV Dependency") + print("--->\t$ sudo apt install python3-opencv -y\t<---") + print("(but you can use other submodules except zerohertzLib.vision)") + print("=" * 100) + +__version__ = "v0.1.10" diff --git a/zerohertzLib/plot/__init__.py b/zerohertzLib/plot/__init__.py index ef645195..b515c8e3 100644 --- a/zerohertzLib/plot/__init__.py +++ b/zerohertzLib/plot/__init__.py @@ -4,6 +4,7 @@ from zerohertzLib.plot.bar import bar, barh, hist from zerohertzLib.plot.pie import pie from zerohertzLib.plot.plot import plot +from zerohertzLib.plot.scatter import scatter plt.rcParams["font.size"] = 20 font_manager.fontManager.addfont( @@ -11,4 +12,4 @@ ) plt.rcParams["font.family"] = "Noto Sans KR" -__all__ = ["bar", "barh", "hist", "plot", "pie"] +__all__ = ["bar", "barh", "hist", "plot", "pie", "scatter"] diff --git a/zerohertzLib/plot/bar.py b/zerohertzLib/plot/bar.py index f86cd0b5..dd479522 100644 --- a/zerohertzLib/plot/bar.py +++ b/zerohertzLib/plot/bar.py @@ -16,7 +16,7 @@ def bar( rot: Optional[int] = 0, per: Optional[bool] = True, ) -> None: - """Dictionary로 입력받은 데이터를 bar graph로 시각화 + """Dictionary로 입력받은 데이터를 가로 bar chart로 시각화 .. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/280595386-1c930639-762a-47b7-9ae1-1babf789803c.png :alt: Visualzation Result @@ -82,7 +82,7 @@ def barh( rot: Optional[int] = 0, per: Optional[bool] = True, ) -> None: - """Dictionary로 입력받은 데이터를 세로 bar graph로 시각화 + """Dictionary로 입력받은 데이터를 세로 bar chart로 시각화 .. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/280707484-361611aa-f1bd-4909-b2a2-fadc26aa1416.png :alt: Visualzation Result diff --git a/zerohertzLib/plot/pie.py b/zerohertzLib/plot/pie.py index a9ec1ecb..37600a53 100644 --- a/zerohertzLib/plot/pie.py +++ b/zerohertzLib/plot/pie.py @@ -10,8 +10,9 @@ def pie( title: Optional[str] = "tmp", ratio: Optional[Tuple[int]] = (15, 10), dpi: Optional[int] = 300, + int_label: Optional[bool] = True, ) -> None: - """Dictionary로 입력받은 데이터를 pie graph로 시각화 + """Dictionary로 입력받은 데이터를 pie chart로 시각화 .. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/282473748-bec83476-9ed6-4fe8-8f1a-2651344c1b7c.png :alt: Visualzation Result @@ -23,6 +24,7 @@ def pie( title (``Optional[str]``): Graph에 표시될 제목 및 파일명 ratio (``Optional[Tuple[int]]``): Graph의 가로, 세로 길이 dpi: (``Optional[int]``): Graph 저장 시 DPI (Dots Per Inch) + int_label: (``Optional[bool]``): Label 내 수치의 소수점 표기 여부 Returns: ``None``: 현재 directory에 바로 graph 저장 @@ -32,10 +34,16 @@ def pie( """ colors = sns.color_palette("husl", n_colors=len(data)) plt.figure(figsize=ratio) - if dim == "": - labels = [f"{k} ({v:.2f})" for k, v in data.items()] + if int_label: + if dim == "": + labels = [f"{k} ({v:.0f})" for k, v in data.items()] + else: + labels = [f"{k} ({v:.0f} {dim})" for k, v in data.items()] else: - labels = [f"{k} ({v:.2f} {dim})" for k, v in data.items()] + if dim == "": + labels = [f"{k} ({v:.2f})" for k, v in data.items()] + else: + labels = [f"{k} ({v:.2f} {dim})" for k, v in data.items()] plt.pie( data.values(), labels=labels, diff --git a/zerohertzLib/plot/plot.py b/zerohertzLib/plot/plot.py index b85b992d..eda99a1c 100644 --- a/zerohertzLib/plot/plot.py +++ b/zerohertzLib/plot/plot.py @@ -13,7 +13,7 @@ def plot( ratio: Optional[Tuple[int]] = (15, 10), dpi: Optional[int] = 300, ) -> None: - """Dictionary로 입력받은 데이터를 bar graph로 시각화 + """List와 Dictionary로 입력받은 데이터를 line chart로 시각화 .. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/280603766-22a0f42c-91b0-4f34-aa73-29de6fdbd4e9.png :alt: Visualzation Result diff --git a/zerohertzLib/plot/scatter.py b/zerohertzLib/plot/scatter.py new file mode 100644 index 00000000..398df631 --- /dev/null +++ b/zerohertzLib/plot/scatter.py @@ -0,0 +1,56 @@ +from typing import Dict, List, Optional, Tuple, Union + +import seaborn as sns +from matplotlib import pyplot as plt + + +def scatter( + data: Dict[str, List[List[Union[int, float]]]], + size: Optional[float] = 36, + xlab: Optional[str] = "x축 [단위]", + ylab: Optional[str] = "y축 [단위]", + title: Optional[str] = "tmp", + ratio: Optional[Tuple[int]] = (15, 10), + dpi: Optional[int] = 300, +) -> None: + """Dictionary로 입력받은 데이터를 scatter plot으로 시각화 + + .. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/282639459-efca04cc-3c4a-42c5-b07d-e64705a5f791.png + :alt: Visualzation Result + :align: center + + Args: + data (``Dict[str, List[List[Union[int, float]]]]``): 입력 데이터 + size (``Optional[int]``): Graph에 출력될 marker의 크기 + xlab (``Optional[str]``): Graph에 출력될 X축 label + ylab (``Optional[str]``): Graph에 출력될 Y축 label + title (``Optional[str]``): Graph에 표시될 제목 및 파일명 + ratio (``Optional[Tuple[int]]``): Graph의 가로, 세로 길이 + dpi: (``Optional[int]``): Graph 저장 시 DPI (Dots Per Inch) + + Returns: + ``None``: 현재 directory에 바로 graph 저장 + + Examples: + >>> zz.plot.scatter({"테란": [list(np.random.rand(200) * 10), list(np.random.rand(200) * 10)], "저그": [list(np.random.rand(200) * 5 - 1), list(np.random.rand(200) * 5 + 1)], "프로토스": [list(np.random.rand(200) * 10 + 3), list(np.random.rand(200) * 10 - 2)]}, size=400, xlab="비용 [미네랄]", ylab="전투력 [점]", title="Star Craft") + """ + colors = sns.color_palette("husl", n_colors=len(data)) + plt.figure(figsize=ratio) + # import matplotlib.markers as mmarkers + # markers = list(mmarkers.MarkerStyle.markers.keys()) + marker = ["o", "v", "^", "s", "p", "*", "x"] + for i, (k, v) in enumerate(data.items()): + plt.scatter( + v[0], v[1], s=size, color=colors[i], marker=marker[i], label=k, zorder=2 + ) + plt.grid(zorder=0) + plt.xlabel(xlab) + plt.ylabel(ylab) + plt.title(title, fontsize=25) + plt.legend() + plt.savefig( + f"{title.lower().replace(' ', '_')}.png", + dpi=dpi, + bbox_inches="tight", + ) + plt.close("all") diff --git a/zerohertzLib/vision/__init__.py b/zerohertzLib/vision/__init__.py index 38d12359..929434e8 100644 --- a/zerohertzLib/vision/__init__.py +++ b/zerohertzLib/vision/__init__.py @@ -1,3 +1,4 @@ from zerohertzLib.vision.gif import img2gif, vid2gif +from zerohertzLib.vision.result import before_after, grid -__all__ = ["img2gif", "vid2gif"] +__all__ = ["img2gif", "vid2gif", "before_after", "grid"] diff --git a/zerohertzLib/vision/result.py b/zerohertzLib/vision/result.py new file mode 100644 index 00000000..2568f42b --- /dev/null +++ b/zerohertzLib/vision/result.py @@ -0,0 +1,136 @@ +import math +from typing import List, Optional, Union + +import cv2 +import numpy as np + + +def _rel2abs(x1: float, x2: float, y1: float, y2: float, w: int, h: int) -> List[int]: + return [int(x1 * w / 100), int(x2 * w / 100), int(y1 * h / 100), int(y2 * h / 100)] + + +def before_after( + before: np.ndarray, + after: np.ndarray, + area: Optional[List[Union[int, float]]] = [0.0, 100.0, 0.0, 100.0], + per: Optional[bool] = True, + quality: Optional[int] = 100, + output_filename: Optional[str] = "tmp", +) -> None: + """두 이미지를 비교하는 이미지 생성 + + .. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/282745206-fcddd725-e596-471d-b66c-27fe296ccb63.png + :alt: Result + :align: center + + Args: + before (``np.ndarray``): 원본 이미지 + after (``np.ndarray``): 영상 처리 혹은 모델 추론 후 이미지 + area: (``Optional[List[Union[int, float]]]``): 비교할 좌표 (``[x1, x2, y1, y2]``) + per (``Optional[bool]``): ``area`` 의 백분율 여부 + quality (``Optional[int]``): 출력 이미지의 quality (단위: %) + output_filename: (``Optional[str]``): 저장될 파일의 이름 + + Returns: + ``None``: 현재 directory에 바로 이미지 저장 + + Examples: + + BGR, GRAY: + + >>> before = cv2.imread("test.jpg") + >>> after = cv2.GaussianBlur(before, (0, 0), 25) + >>> after = cv2.cvtColor(after, cv2.COLOR_BGR2GRAY) + >>> zz.vision.before_after(before, after, quality=10) + + BGR, Resize: + + >>> before = cv2.imread("test.jpg") + >>> after = cv2.resize(before, (100, 100)) + >>> zz.vision.before_after(before, after, [20, 40, 30, 60]) + """ + before_shape = before.shape + if per: + x1, x2, y1, y2 = _rel2abs(*area, *before_shape[:2]) + else: + x1, x2, y1, y2 = area + if len(before_shape) == 2: + before = cv2.cvtColor(before, cv2.COLOR_GRAY2BGR) + before_shape = before.shape + after_shape = after.shape + if len(after_shape) == 2: + after = cv2.cvtColor(after, cv2.COLOR_GRAY2BGR) + after_shape = after.shape + if not before_shape == after_shape: + after = cv2.resize(after, before_shape[:2][::-1]) + after_shape = after.shape + before, after = before[x1:x2, y1:y2, :], after[x1:x2, y1:y2, :] + before_shape = before.shape + H, W, C = before_shape + palette = np.zeros((H, 2 * W, C), dtype=np.uint8) + palette[:, :W, :] = before + palette[:, W:, :] = after + palette = cv2.resize(palette, (0, 0), fx=quality / 100, fy=quality / 100) + cv2.imwrite(f"{output_filename}.png", palette) + + +def grid( + *imgs: List[np.array], + size: int = 1000, + output_filename: Optional[str] = "tmp", +): + """여러 이미지를 입력받아 한 이미지로 병합 + + .. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/42334717/282752504-591cf407-c5bc-460b-99cf-0be569198855.png + :alt: Result + :align: center + + Args: + *imgs (``List[np.array]``): 입력 이미지 + size: (``int``): 출력 이미지의 크기 + output_filename: (``Optional[str]``): 저장될 파일의 이름 + + Returns: + ``None``: 현재 directory에 바로 이미지 저장 + + Examples: + >>> tmp = cv2.imread("test.jpg") + >>> imgs = [(tmp + np.random.rand(*tmp.shape)).astype(np.uint8) for _ in range(8)] + >>> imgs[2] = cv2.cvtColor(imgs[2], cv2.COLOR_BGR2GRAY) + >>> zz.vision.grid(*imgs) + """ + cnt = math.ceil(math.sqrt(len(imgs))) + length = size // cnt + size = int(length * cnt) + palette = np.full((size, size, 3), 255, dtype=np.uint8) + for idx, img in enumerate(imgs): + y, x = divmod(idx, cnt) + x1, x2, y1, y2 = x * length, (x + 1) * length, y * length, (y + 1) * length + if len(img.shape) == 2: + img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) + H, W, _ = img.shape + if H > W: + h, w = length, int(length / H * W) + gap = (length - w) // 2 + x1, x2, y1, y2 = ( + x * length + gap, + x * length + gap + w, + y * length, + (y + 1) * length, + ) + elif W < H: + h, w = int(length / W * H), length + gap = (length - h) // 2 + x1, x2, y1, y2 = ( + x * length, + (x + 1) * length, + y * length + gap, + y * length + gap + h, + ) + x1, x2, y1, y2 = x * length, (x + 1) * length, y * length, (y + 1) * length + else: + h = w = length + x1, x2, y1, y2 = x * length, (x + 1) * length, y * length, (y + 1) * length + img = cv2.resize(img, (w, h)) + palette[y1:y2, x1:x2, :] = img + cv2.imwrite(f"{output_filename}.png", palette)