Skip to content
Open
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "anchor/third_party/ace"]
path = anchor/third_party/ace
url = https://github.com/Mickmcginnis/ace
[submodule "anchor/third_party/Zero-DCE"]
path = anchor/third_party/Zero-DCE
url = [email protected]:Li-Chongyi/Zero-DCE.git
[submodule "anchor/third_party/zero_dce"]
path = anchor/third_party/zero_dce
url = [email protected]:ayushchakra/zero_dce.git
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
42 changes: 26 additions & 16 deletions anchor/backend/data/ace.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,19 @@ def process_training_data(
firebase_processed_tar_path: str = str(
Path(combined_path).parent.parent / f"processedTrainingTars/{tar_name}"
)
downloader.delete_file((Path(firebase_tar_queue_path) / tar_name).as_posix())
downloader.upload_file(
remote_location=firebase_processed_tar_path,
local_location=downloader.local_tar_location,
)
print("[INFO]: Moved tar from tarQueue to processedTars directory in firebase")
try:
downloader.delete_file(
(Path(firebase_tar_queue_path) / tar_name).as_posix()
)
downloader.upload_file(
remote_location=firebase_processed_tar_path,
local_location=downloader.local_tar_location,
)
print(
"[INFO]: Moved tar from tarQueue to processedTars directory in firebase"
)
except:
print("[WARNING] Unable to Move tar")


@dataclass
Expand Down Expand Up @@ -396,12 +403,12 @@ def process_testing_data(
prepare_ace_data(downloader.extracted_data)
os.chdir(Path(__file__).parent.parent.parent / "third_party/ace")
extracted_ace_folder = downloader.local_extraction_location / "ace"
model_name = Path(combined_path).stem.split("training_")[-1]
model_name = "_".join(model_name.split("_")[2:])

if model_data_folder:
model_weights_path = model_data_folder / "model.pt"
else:
model_name = Path(combined_path).stem.split("training_")[-1]
model_name = "_".join(model_name.split("_")[2:])
for dir, _, _ in os.walk(downloader.root_download_dir):
dir_path = Path(dir)
if str(dir_path).endswith(model_name) and dir_path.parts[-1].startswith(
Expand Down Expand Up @@ -434,14 +441,17 @@ def process_testing_data(
tars = list_tars()

# tars = ["training_ua-7c140933b99a14568ee768781fb5c9b2_ayush_mar_4_5_combined"]
tars = [
# 9:30
"testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3.tar",
# 12:00
"testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3.tar",
# Days later
"testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3.tar",
]
# tars = [
# "training_ua-7c140933b99a14568ee768781fb5c9b2_ayush_mar_4_5_combined_better_enhancement",
# "training_ua-7c140933b99a14568ee768781fb5c9b2_ayush_mar_4_better_enhancement",
# "training_ua-1bab71c5f9279e0777539be4abd6ae2b_ayush_mar_5_better_enhancement",
# # # 9:30
# # "testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3",
# # # 12:00
# # "testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3",
# # # Days later
# # "testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3",
# ]

print("Processing: \n" + "\n".join(tars))

Expand Down
1 change: 1 addition & 0 deletions anchor/backend/data/extracted.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def match_all_sensor(self):
for phase in self.sensors_extracted:
for sensor in self.sensors_extracted[phase]:
if sensor not in ["video", "april_tags", "google_cloud_anchor"]:
breakpoint()
self.match_given_sensor(phase, sensor)

def transform_poses_in_global_frame(self):
Expand Down
28 changes: 18 additions & 10 deletions anchor/backend/data/firebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,28 @@ def list_tars():
FirebaseDownloader.initialized = True
bucket = storage.bucket(FirebaseDownloader.firebase_bucket_name)
# database = db.reference(url="https://stepnavigation-default-rtdb.firebaseio.com/")
# breakpoint()
tar_queue = "iosLoggerDemo/processedTrainingTars/"
tars = bucket.list_blobs(prefix=tar_queue)

tar_names = []
# tar_queue = "iosLoggerDemo/processedTrainingTars/"
# tars = bucket.list_blobs(prefix=tar_queue)

for tar in tars:
if tar.name.endswith(".tar") and "ayush_mar_" in tar.name:
tar_names.append(tar.name)

tar_queue = "iosLoggerDemo/processedTestTars/"
# for tar in tars:
# if tar.name.endswith(".tar") and "ayush_mar_" in tar.name:
# tar_names.append(tar.name)

# tar_queue = "iosLoggerDemo/processedTestTars/"
# tars = bucket.list_blobs(prefix=tar_queue)
# for tar in tars:
# if tar.name.endswith(".tar") and "ayush_mar_" in tar.name:
# tar_names.append(tar.name)

tar_queue = "iosLoggerDemo/tarQueue/"
tars = bucket.list_blobs(prefix=tar_queue)
for tar in tars:
if tar.name.endswith(".tar") and "ayush_mar_" in tar.name:
if (
tar.name.endswith(".tar")
and "ayush_april_3" in tar.name
):
tar_names.append(tar.name)

return tar_names
Expand Down Expand Up @@ -120,7 +128,7 @@ def extract_ios_logger_tar(self) -> Path:
)

# extract the videos by phase (test videos will not have mapping data so they need to be handled separately)
if str(self.local_tar_location).endswith("_combined"):
if "combined" in str(self.local_tar_location):
self.combine_extract_ios_logger_video(mapping_phase=False)
self.combine_extract_ios_logger_video(mapping_phase=True)
self.combine_extract_intrinsics(mapping_phase=False)
Expand Down
17 changes: 10 additions & 7 deletions anchor/backend/data/multi_model_ace.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
import google

combined_model_name = (
"training_ua-7c140933b99a14568ee768781fb5c9b2_ayush_mar_4_5_combined"
"training_ua-7c140933b99a14568ee768781fb5c9b2_ayush_mar_4_5_combined_better_enhancement"
)
individual_model_names = [
"training_ua-7c140933b99a14568ee768781fb5c9b2_ayush_mar_4",
"training_ua-1bab71c5f9279e0777539be4abd6ae2b_ayush_mar_5",
"training_ua-7c140933b99a14568ee768781fb5c9b2_ayush_mar_4_better_enhancement",
"training_ua-1bab71c5f9279e0777539be4abd6ae2b_ayush_mar_5_better_enhancement",
]
test_datasets = [
# 9:30
"testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3.tar",
"testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3_better_enhancement",
# 12:00
"testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3.tar",
"testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3_better_enhancement",
# Days later
"testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3.tar",
"testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3_better_enhancement",
]
OUTPUT_BASE_DIR = Path(__file__).parent / ".cache/multi_model_results"
OUTPUT_BASE_DIR = Path(__file__).parent / ".cache/better_enhancement_multi_model_results"


def send_localization_request(
Expand Down Expand Up @@ -152,6 +152,9 @@ def main2():
Path(__file__).parent / f".cache/firebase_data/{model_name}/ace",
)

if not OUTPUT_BASE_DIR.exists():
os.mkdir(OUTPUT_BASE_DIR)

output_dir = OUTPUT_BASE_DIR / test_name.rstrip(".tar")
if not output_dir.exists():
os.mkdir(output_dir)
Expand Down
Binary file added anchor/backend/eval/imgs/hor_phone/frame.png
Binary file added anchor/backend/eval/imgs/hor_phone/trans.png
68 changes: 55 additions & 13 deletions anchor/backend/eval/run_eval.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
import json
from utils.error import compute_rotational_error, compute_translation_error
from utils.data_models import (
from anchor.backend.eval.utils.error import compute_rotational_error, compute_translation_error
from anchor.backend.eval.utils.data_models import (
TestInfo,
MapTestInfo,
FrameData,
Expand All @@ -25,16 +25,16 @@
}
MULTI_MODEL_TEST_MAPPINGS = {
# 9:30
1: "testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3",
1: "testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3_better_enhancement",
# 12:00
2: "testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3",
2: "testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3_better_enhancement",
# Days later
3: "testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3",
3: "testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3_better_enhancement",
}
MULTI_MODEL_TEST_METADATA_MAPPINGS = {
"testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3": "9:30 PM",
"testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3": "12:00 PM",
"testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3": "9:30 PM (Days Later)",
"testing_2E4723D2-57C7-4AA1-B3B3-CE276ABF0DC7_ayush_mar_3_better_enhancement": "9:30 PM",
"testing_7AAC6056-FEA5-4712-8134-26B13499316C_ayush_mar_3_better_enhancement": "12:00 PM",
"testing_FE49EDB3-4A95-4B60-A942-5E41463DAEEF_ayush_mar_3_better_enhancement": "9:30 PM (Days Later)",
}
FIGURE_DIR = Path(__file__).parent / "imgs"

Expand Down Expand Up @@ -245,7 +245,7 @@ def frame_bar_chart(dataset_name: str, visualize: bool, save: bool, smooth_ace:
def analyze_multi_model_datasets(dataset_name, visualize: bool, save: bool):
data_file = (
Path(__file__).parent.parent
/ "data/.cache/multi_model_results"
/ "data/.cache/better_enhancement_multi_model_results"
/ dataset_name
/ "results.json"
)
Expand All @@ -262,8 +262,50 @@ def analyze_multi_model_datasets(dataset_name, visualize: bool, save: bool):

mm_analyzer = MultiModelAnalysis(results)

fig = plt.figure()
# data_file = (
# Path(__file__).parent.parent
# / "data/.cache/multi_model_results"
# / dataset_name.strip("_better_enhancement")
# / "results.json"
# )
# with open(data_file, "r") as file:
# results = json.load(file)

# for model_name, data in results.items():
# results[model_name] = TestDatum(
# frames=[FrameData(**args) for args in data],
# root_dir=Path(__file__).parent.parent
# / "data/.cache/firebase_data"
# / model_name.strip("_better_enhancement"),
# )

# other_analyzer = MultiModelAnalysis(results)
# delta_trans_model0 = {}
# delta_trans_model1 = {}
# delta_num_model0 = {}
# delta_num_model1 = {}
# for key in mm_analyzer.model0_avg_translation_errs:
# delta_trans_model0[key] = mm_analyzer.model0_avg_translation_errs[key] - other_analyzer.model0_avg_translation_errs[key]
# delta_trans_model1[key] = mm_analyzer.model1_avg_translation_errs[key] - other_analyzer.model1_avg_translation_errs[key]
# delta_num_model0[key] = mm_analyzer.model0_num_frames[key]- other_analyzer.model0_num_frames[key]
# delta_num_model1[key] = mm_analyzer.model1_num_frames[key] - other_analyzer.model1_num_frames[key]

# print(f"Test Time: {MULTI_MODEL_TEST_METADATA_MAPPINGS[dataset_name]}")
# print("All Calculations are Rotated Results minus Original Results")
# import pprint
# print("Results of Model Trained on Night Dataset (9:30 PM)")
# print("Delta Translational Error:")
# pprint.pp(delta_trans_model0)
# print("Delta Number of Frames:")
# pprint.pp(delta_num_model0)
# print("Results of Model Trained on Day Dataset (12:00 PM)")
# print("Delta Translational Error:")
# pprint.pp(delta_trans_model1)
# print("Delta Number of Frames:")
# pprint.pp(delta_num_model1)
# print("\n\n\n")

fig = plt.figure()
plt.rcParams.update({"font.size": 8})
ax = fig.add_subplot(2, 2, 1)
independent_trans_errs = mm_analyzer.independent_avg_translation_errs
Expand Down Expand Up @@ -329,7 +371,7 @@ def analyze_multi_model_datasets(dataset_name, visualize: bool, save: bool):

if save:
plt.savefig(
FIGURE_DIR / f"multimodel/{dataset_name.split('_')[1]}/trans_err_bar"
FIGURE_DIR / f"better_enhancement_multimodel/{dataset_name.split('_')[1]}/trans_err_bar"
)

if visualize:
Expand Down Expand Up @@ -399,7 +441,7 @@ def analyze_multi_model_datasets(dataset_name, visualize: bool, save: bool):
)

if save:
plt.savefig(FIGURE_DIR / f"multimodel/{dataset_name.split('_')[1]}/frame_bar")
plt.savefig(FIGURE_DIR / f"better_enhancement_multimodel/{dataset_name.split('_')[1]}/frame_bar")

if visualize:
plt.show()
Expand Down Expand Up @@ -478,7 +520,7 @@ def analyze_multi_model_datasets(dataset_name, visualize: bool, save: bool):
args.s
and args.mm
and not (
dir := FIGURE_DIR / f"multimodel/{dataset_name.split('_')[1]}"
dir := FIGURE_DIR / f"better_enhancement_multimodel/{dataset_name.split('_')[1]}"
).exists()
):
os.mkdir(dir)
Expand Down
Loading