-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2d3858
commit 62a1f3f
Showing
46 changed files
with
191 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from T2IBenchmark import calculate_fid | ||
from T2IBenchmark.datasets import get_coco_fid_stats | ||
|
||
def calculate_fid_score(image_path): | ||
""" | ||
Calculate the FID score for a given path of images. | ||
Parameters: | ||
image_path (str): The path to the directory containing the generated images. | ||
Returns: | ||
float: The calculated FID score. | ||
""" | ||
fid, _ = calculate_fid( | ||
image_path, | ||
get_coco_fid_stats() | ||
) | ||
return fid | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
if len(sys.argv) != 2: | ||
print("Usage: python calculate_fid_score.py <image_path>") | ||
else: | ||
image_path = sys.argv[1] | ||
print(image_path) | ||
fid = calculate_fid_score(image_path) | ||
print(f"FID score: {fid}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# Setup script for image generation model benchmarking | ||
|
||
# Directories for images | ||
coco_30k_image_dir="/home/lixiang/data/fid_kolors_torch" | ||
|
||
# CSV file path | ||
csv_path="resources/MS-COCO_val2014_30k_captions.csv" | ||
|
||
# Log file path | ||
log_file="benchmark_log.txt" | ||
|
||
# Redirect all output and errors to log file | ||
exec > >(tee -a "$log_file") 2>&1 | ||
|
||
echo "Starting the benchmarking process at $(date)" | ||
|
||
# Check if image directory exists | ||
if [ ! -d "$coco_30k_image_dir" ]; then | ||
echo "Error: Image directory does not exist: $coco_30k_image_dir" | ||
exit 1 | ||
fi | ||
|
||
# Check if CSV file exists | ||
if [ ! -f "$csv_path" ]; then | ||
echo "Error: CSV file does not exist: $csv_path" | ||
exit 1 | ||
fi | ||
|
||
# Execute Python scripts for different metrics and log results | ||
echo "Calculating FID Score..." | ||
python3 metrics/fid_score.py "$coco_30k_image_dir" | ||
|
||
echo "Calculating Inception Score..." | ||
python3 metrics/inception_score.py --path "$coco_30k_image_dir" | ||
|
||
echo "Calculating CLIP Score..." | ||
python3 metrics/clip_score.py "$coco_30k_image_dir" "$csv_path" | ||
|
||
echo "Calculating Aesthetic Score..." | ||
python3 metrics/aesthetic_score.py --image_path "$coco_30k_image_dir" | ||
|
||
echo "Calculating Structural Similarity Index..." | ||
python3 metrics/structural_similarity.py --folder1 "$coco_30k_image_dir" --folder2 "$coco_30k_image_dir" | ||
|
||
echo "Benchmarking process completed at $(date)" |
File renamed without changes.
File renamed without changes.
File renamed without changes.