INNER CODE UNIT · Python
load_annotations
virajmavani/semi-auto-image-annotation-tool · web/backend/main.py:563
async def load_annotations(filename: str):
"""Load previously saved annotations for an image"""
try:
validate_filename(filename)
# Try to load from CSV first
csv_path = ANNOTATIONS_DIR / "annotations.csv"
bboxes = []
if csv_path.exists():
with open(csv_path, "r") as f:
for line in f:
parts = line.strip().split(',')
if len(parts) >= 6 and parts[0] == filename:
bboxes.append({
"x1": int(parts[1]),
"y1": int(parts[2]),
"x2": int(parts[3]),