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

Added comments to evaluation scripts #59

Merged
merged 1 commit into from
Dec 4, 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
1 change: 1 addition & 0 deletions benchmark_testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Note: One such pair of sample database and queries directories have already been

> [!NOTE]\
> *All the code below should be executed from the `benchmark_testing` directory.*
> Make sure to execute all .sh files using git bash.

2. **Run Test Data Setup (Optional)**
- Replace the directory names in the `test_data_setup.py` file with appropriate directory locations.
Expand Down
7 changes: 5 additions & 2 deletions benchmark_testing/run_bulk_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ sleep 10
# Start timer
start_time=$(date +%s)

# Run your functions or any additional Python commands here
python ../src/Sample_Client/sample_bulk_upload_client.py --directory_paths "\path\to\input\directory" --database_name "sample_db"
# Call client script to upload images from to database (the code currently only accepts one directory at a time)
python ../src/Sample_Client/sample_bulk_upload_client.py --directory_paths "\\path\\to\\sample_database\\directory" --database_name "sample_db"

# Sample directory path
# "<path to dataset folder>\\LFWdataset\\sample_database"

# Calculate total time taken
end_time=$(date +%s)
Expand Down
8 changes: 6 additions & 2 deletions benchmark_testing/run_face_find_accuracy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ sleep 10
start_time=$(date +%s)

# Define the directory containing the files and the output CSV file
input_directory="\path\to\input\directory"
output_csv="\path\to\output\csv"
input_directory="\\path\\to\\input\\directory" # Path to directory of query images
output_csv="\\path\\to\\output\\csv" # Path to csv file containing top-n matches

# Sample directory path
# input_directory = "<path to dataset folder>\\LFWdataset\\sample_queries"
# output_csv = "<path to dataset folder>\\LFWdataset\\output.csv"

# Initialize the CSV file with headers
echo "filename,result" > "$output_csv"
Expand Down
5 changes: 4 additions & 1 deletion benchmark_testing/run_face_find_time.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ sleep 10
# Start timer
start_time=$(date +%s)

# Run your functions or any additional Python commands here
# Call client script to find match for an image (code currently only accepts one file_path at a time)
python ../src/Sample_Client/sample_find_face_client.py --file_paths "\path\to\image" --database_name "sample_db"

# Sample file path
# "<path to dataset folder>\\LFWdataset\\sample_queries\\image.jpg"

# Calculate total time taken
end_time=$(date +%s)
total_time=$((end_time - start_time))
Expand Down
6 changes: 5 additions & 1 deletion benchmark_testing/test_data_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from sklearn.metrics import accuracy_score

# Load the CSV file
file_path = "path\\to\\output\\csv"
file_path = "path\\to\\output\\csv" # Path to csv file containing top-n matches

# Sample csv path
# file_path = "<path to dataset folder>\\LFWdataset\\output.csv"

data = pd.read_csv(file_path)

# Extract ground truth names (base names without numeric suffixes)
Expand Down
19 changes: 15 additions & 4 deletions benchmark_testing/test_data_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,21 @@ def count_files(directory):
)


# Specify the root directory you want to start from
root_directory = "\\path\\to\\root\\directory"
upload_directory = "\\path\\to\\upload\\directory"
test_directory = "\\path\\to\\test\\directory"
# Edit the following paths to match your system's directories

root_directory = "\\path\\to\\root\\directory" # Original dataset directory
upload_directory = "\\path\\to\\upload\\directory" # Directory where images to be uploaded to database will be stored
test_directory = (
"\\path\\to\\test\\directory" # Directory where query images will be stored
)

"""
Sample directories
root_directory = "<path to dataset folder>\\LFWdataset\\lfw"
upload_directory = "<path to dataset folder>\\LFWdataset\\sample_database"
test_directory = "<path to dataset folder>\\LFWdataset\\sample_queries"
"""

process_directory(root_directory, upload_directory, test_directory)

# Print the number of files in the test and verify directories
Expand Down
Loading