Skip to content

Commit

Permalink
chore: update david benchmark script to import from examples
Browse files Browse the repository at this point in the history
  • Loading branch information
qh681248 committed Jan 17, 2025
1 parent 4608405 commit dc3b72e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions benchmark/david_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"""

import os
import sys
import time
from pathlib import Path
from typing import Optional
Expand All @@ -38,20 +39,23 @@
import matplotlib.pyplot as plt
import numpy as np
from jax import random
from mnist_benchmark import get_solver_name, initialise_solvers

from benchmark.mnist_benchmark import get_solver_name, initialise_solvers
from coreax import Data
from coreax.solvers import MapReduce
from examples.david_map_reduce_weighted import downsample_opencv

sys.path.append(str(Path(__file__).parent.parent))


MAX_8BIT = 255


# pylint: disable=too-many-locals
def benchmark_coreset_algorithms(
in_path: Path = Path("../examples/data/david_orig.png"),
out_path: Optional[Path] = Path("david_benchmark_results.png"),
downsampling_factor: int = 1,
downsampling_factor: int = 6,
):
"""
Benchmark the performance of coreset algorithms on a downsampled greyscale image.
Expand All @@ -66,7 +70,6 @@ def benchmark_coreset_algorithms(
"""
# Base directory of the current script
base_dir = os.path.dirname(os.path.abspath(__file__))

# Convert to absolute paths using os.path.join
if not in_path.is_absolute():
in_path = Path(os.path.join(base_dir, in_path))
Expand Down

0 comments on commit dc3b72e

Please sign in to comment.