-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add evaluation test to regression testing (#255)
- Loading branch information
Showing
10 changed files
with
191 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -608,6 +608,7 @@ | |
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "303428e3", | ||
"metadata": {}, | ||
|
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,65 @@ | ||
################################################################################################### | ||
# | ||
# Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. | ||
# This software is proprietary to Analog Devices, Inc. and its licensors. | ||
# | ||
################################################################################################### | ||
""" | ||
Create training bash scripts for test | ||
""" | ||
import argparse | ||
import os | ||
|
||
import yaml | ||
|
||
|
||
def joining(lst): | ||
""" | ||
Join list based on the ' ' delimiter | ||
""" | ||
join_str = ' '.join(lst) | ||
return join_str | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--testconf', help='Enter the config file for the test', required=True) | ||
parser.add_argument('--testpaths', help='Enter the paths for the test', required=True) | ||
args = parser.parse_args() | ||
yaml_path = args.testconf | ||
test_path = args.testpaths | ||
|
||
# Open the YAML file | ||
with open(yaml_path, 'r', encoding='utf-8') as yaml_file: | ||
# Load the YAML content into a Python dictionary | ||
config = yaml.safe_load(yaml_file) | ||
|
||
with open(test_path, 'r', encoding='utf-8') as path_file: | ||
# Load the YAML content into a Python dictionary | ||
pathconfig = yaml.safe_load(path_file) | ||
|
||
# Folder containing the files to be concatenated | ||
script_path = pathconfig["script_path"] | ||
|
||
# Output file name and path | ||
output_file_path = pathconfig["output_file_path_evaluation"] | ||
|
||
# Loop through all files in the folder | ||
with open(output_file_path, "w", encoding='utf-8') as evaluate_file: | ||
for filename in os.listdir(script_path): | ||
# Check if the file is a text file | ||
if filename.startswith("evaluate"): | ||
# Open the file and read its contents | ||
with open(os.path.join(script_path, filename), encoding='utf-8') as input_file: | ||
contents = input_file.read() | ||
temp = contents.split() | ||
temp.insert(1, "\n") | ||
|
||
i = temp.index("--exp-load-weights-from") | ||
temp[i+1] = temp[i+1][1:] | ||
|
||
temp.insert(-1, "--name " + filename[9:-3]) | ||
temp.insert(-1, "--data /data_ssd") | ||
|
||
temp.append(" \n") | ||
contents = joining(temp) | ||
evaluate_file.write(contents) |
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 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,46 @@ | ||
################################################################################################### | ||
# | ||
# Copyright (C) 2023 Analog Devices, Inc. All Rights Reserved. | ||
# This software is proprietary to Analog Devices, Inc. and its licensors. | ||
# | ||
################################################################################################### | ||
""" | ||
Check the test results | ||
""" | ||
import argparse | ||
import os | ||
|
||
import yaml | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--testpaths', help='Enter the paths for the test', required=True) | ||
args = parser.parse_args() | ||
test_path = args.testpaths | ||
|
||
# Open the YAML file | ||
with open(test_path, 'r', encoding='utf-8') as path_file: | ||
# Load the YAML content into a Python dictionary | ||
pathconfig = yaml.safe_load(path_file) | ||
|
||
eval_path = pathconfig["eval_path"] | ||
eval_file = os.listdir(eval_path)[-1] | ||
directory_path = os.path.join(eval_path, eval_file) | ||
passed = [] | ||
failed = [] | ||
|
||
for filename in sorted(os.listdir(directory_path)): | ||
path = os.path.join(directory_path, filename) | ||
file_path = os.path.join(path, os.listdir(path)[0]) | ||
with open(file_path, 'r', encoding='utf-8') as file: | ||
content = file.read() | ||
if "Loss" in content: | ||
pass_file = filename.split("___")[0] | ||
passed.append(f"\033[32m\u2714\033[0m Evaluation test passed for {pass_file}.") | ||
else: | ||
fail_file = filename.split("___")[0] | ||
failed.append(f"\033[31m\u2718\033[0m Evaluation test failed for {fail_file}.") | ||
|
||
for filename in failed: | ||
print(filename) | ||
for filename in passed: | ||
print(filename) |
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 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