Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to metrics directory #24

Merged
merged 7 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions .github/workflows/layout_unreadability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,5 @@ jobs:
HF_EMAIL: ${{ secrets.HF_EMAIL }}
SCRIPTS_DIR: ${{ env.SRC_DIR }}/scripts
run: |
SCRIPT_NAME=${REPO_NAME}.py

cp ${SRC_DIR}/${DIR_NAME}/README.md ${DST_DIR}/README.md
cp ${SRC_DIR}/${DIR_NAME}/${SCRIPT_NAME} ${DST_DIR}/${SCRIPT_NAME}

git -C ${DST_DIR} config user.name "${HF_USERNAME}"
git -C ${DST_DIR} config user.email "${HF_EMAIL}"

git -C ${DST_DIR} add README.md requirements.txt ${SCRIPT_NAME}

if git -C ${DST_DIR} diff --cached --quiet; then
echo "No changes to commit"
else
msg=$(git -C ${SRC_DIR} rev-parse HEAD)
git -C ${DST_DIR} commit -m "deploy: ${msg}"
git -C ${DST_DIR} push -u origin main
fi
makefile_path=${SRC_DIR}/Makefile
make -f ${makefile_path} deploy REPO_NAME=${REPO_NAME} DIR_NAME=${DIR_NAME}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

PKU_PosterLayout_all

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ A collection of metrics to evaluate layout generation that can be easily used in
| [![Alignment](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_alignment.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_alignment.yaml) | [`creative-graphic-design/layout-alignment`](https://huggingface.co/spaces/creative-graphic-design/layout-alignment) | [[Lee+ ECCV'20](https://arxiv.org/abs/1912.09421)], [[Li+ TVCG'21](https://arxiv.org/abs/2009.05284)], [[Kikuchi+ ACMMM'21](https://arxiv.org/abs/2108.00871)] |
| [![Overlap](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_overlap.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_overlap.yaml) | [`creative-graphic-design/layout-overlap`](https://huggingface.co/spaces/creative-graphic-design/layout-overlap) | [[Li+ ICLR'19](https://arxiv.org/abs/1901.06767)], [[Li+ TVCG'21](https://arxiv.org/abs/2009.05284)], [[Kikuchi+ ACMMM'21](https://arxiv.org/abs/2108.00871)] |
| [![Validity](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_validity.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_validity.yaml) | | [[Hsu+ CVPR'23](https://arxiv.org/abs/2303.15937)] |

# How to use
| [![Occlusion](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_occlusion.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_occlusion.yaml) | | |
| [![Overlap](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_overlap.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_overlap.yaml) | | |
| [![Overlay](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_overlay.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_overlay.yaml) | | |
| [![Underlay Effectiveness](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_underlay_effectivness.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_underlay_effectivness.yaml) | | |
| [![Unreadability](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_unreadability.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_unreadability.yaml) | | |
| [![Non-Alignment](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_non_alignment.yaml/badge.svg)](https://github.com/creative-graphic-design/huggingface-evaluate_layout-metrics/actions/workflows/layout_non_alignment.yaml) | | |

# Usage

- Install [`evaluate`](https://huggingface.co/docs/evaluate/index) library

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions scripts/push_to_hub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ set -eux

function main() {
script_name=${REPO_NAME}.py

# Copy the script to the destination directory
cp ${SRC_DIR}/${DIR_NAME}/README.md ${DST_DIR}/README.md
cp ${SRC_DIR}/${DIR_NAME}/${script_name} ${DST_DIR}/${script_name}
cp ${SRC_DIR}/metrics/${DIR_NAME}/README.md ${DST_DIR}/README.md
cp ${SRC_DIR}/metrics/${DIR_NAME}/${script_name} ${DST_DIR}/${script_name}

# Set configuration for git
git -C ${DST_DIR} config user.name ${HF_USERNAME}
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import torch


@pytest.fixture
def metrics_dir() -> pathlib.Path:
return pathlib.Path(__file__).parents[1] / "metrics"


@pytest.fixture
def test_fixture_dir() -> pathlib.Path:
return pathlib.Path(__file__).parents[1] / "test_fixtures"
Expand Down
6 changes: 3 additions & 3 deletions tests/layout_alignment_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_alignment"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_alignment"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-alignment.py")


Expand Down
6 changes: 3 additions & 3 deletions tests/layout_average_iou_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_average_iou"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_average_iou"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-average-iou.py")


Expand Down
6 changes: 3 additions & 3 deletions tests/layout_generative_model_scores_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_generative_model_scores"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_generative_model_scores"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-generative-model-scores.py")


Expand Down
6 changes: 3 additions & 3 deletions tests/layout_maximum_iou_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_maximum_iou"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_maximum_iou"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-maximum-iou.py")


Expand Down
7 changes: 4 additions & 3 deletions tests/layout_non_alignment_test.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import os
import pathlib

import evaluate
import pytest
import torch


@pytest.fixture
def base_dir() -> str:
return "layout_non_alignment"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_non_alignment"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-non-alignment.py")


Expand Down
6 changes: 3 additions & 3 deletions tests/layout_occulusion_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_occlusion"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_occlusion"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-occlusion.py")


Expand Down
6 changes: 3 additions & 3 deletions tests/layout_overlap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_overlap"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_overlap"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-overlap.py")


Expand Down
7 changes: 4 additions & 3 deletions tests/layout_overlay_test.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import os
import pathlib

import evaluate
import pytest
import torch


@pytest.fixture
def base_dir() -> str:
return "layout_overlay"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_overlay"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-overlay.py")


Expand Down
5 changes: 3 additions & 2 deletions tests/layout_underlay_effectiveness_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
import pathlib

import evaluate
import pytest
import torch


@pytest.fixture
def base_dir() -> str:
return "layout_underlay_effectiveness"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_underlay_effectiveness"


@pytest.fixture
Expand Down
6 changes: 3 additions & 3 deletions tests/layout_unreadability_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_unreadability"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_unreadability"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-unreadability.py")


Expand Down
6 changes: 3 additions & 3 deletions tests/layout_utility_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@


@pytest.fixture
def base_dir() -> str:
return "layout_utility"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_utility"


@pytest.fixture
def metric_path(base_dir: str) -> str:
def metric_path(base_dir: pathlib.Path) -> str:
return os.path.join(base_dir, "layout-utility.py")


Expand Down
5 changes: 3 additions & 2 deletions tests/layout_validity_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
import pathlib

import evaluate
import pytest
import torch


@pytest.fixture
def base_dir() -> str:
return "layout_validity"
def base_dir(metrics_dir: pathlib.Path) -> pathlib.Path:
return metrics_dir / "layout_validity"


@pytest.fixture
Expand Down
Loading