Posted on

System Architecture and Model Selection

Hardware Configuration

Detection Targets and Model Comparison


Data Sampling and Inference Pipeline


Data Storage Structure and Processing Logic

Workflow Overview

Core Code Implementation

def detect_objects(image_name):
    results = model([image_name], imgsz=1024, conf=0.4, verbose=False)
    for result in results:
        result_json = result.to_json()
        name_counts = count_name_values(result_json)
        c.execute('INSERT INTO counts (image_name) VALUES (?)', (image_name,))
        count_id = c.lastrowid
        for name, count in name_counts.items():
            c.execute(f'UPDATE counts SET "{name}" = ? WHERE id = ?', (count, count_id))
        conn.commit()
    return name_counts
images_dir = "images"
jpg_list = [f for f in os.listdir(images_dir) if f.endswith('.jpg')]
for jpg in tqdm(jpg_list, desc="Processing images"):
    detect_objects(jpg)
conn.close()

Statistical Findings

Line chart of one week of data

Every-10-minute counts on Saturday and Sunday

Total dogs per 10-minute interval over one week


Experiment Summary


Technical Challenges and Practical Constraints

Insufficient Nighttime Illumination

Duplicate Counting Across Frames