CoolFace
Apppublic

VishalN17/ar-scene-graph-env

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

AR Scene Graph Builder โ€” OpenEnv

![Unit Tests](https://github.com/Vishal17082k06/ARSceneGraphBuilder/actions) ![License: MIT](https://opensource.org/licenses/MIT)

An advanced Reinforcement Learning (RL) environment for AI agents to master AR spatial placement. This environment simulates the complex decision-making logic of Meta's Ray-Ban Meta and Orion AR glasses, specifically how they anchor virtual content (notifications, UI panels, navigation) into real-world physical spaces.


๐Ÿ—๏ธ System Architecture

mermaid
graph TD
    A[RL Agent / LLM] -->|Action| B[FastAPI Server]
    B -->|Schema Validation| C[ARSceneGraphEnv]
    C -->|State Update| D[NumPy Geometry Engine]
    D -->|Coordinate Check| E[Surface/Obstacle Map]
    C -->|Reward Logic| F[Scoring Engine]
    F -->|Baseline Bonus| G[Anchor Appropriateness]
    F -->|Dimming Penalty| H[Lighting Model]
    C -->|Observation| A

๐Ÿš€ Key Features

1. High-Fidelity AR Anchoring

The environment introduces critical spatial computing concepts for agent training:

  • โ€”`world_locked`: Fixed to global coordinates (best for static furniture/screens).
  • โ€”`head_locked`: Fixed to the user's viewport (best for HUD/ambient alerts).
  • โ€”`gaze_anchored`: Floats in view with smooth inertia/drift (best for notifications).

2. Environment Diversity

Scenario-based testing across multiple high-context environments:

  • โ€”๐Ÿ  Indoor Room: Controlled baseline.
  • โ€”๐Ÿข Office / Restaurant: Dense obstacle navigation.
  • โ€”๐Ÿ™๏ธ Outdoor Street: Wide-area navigation with dynamic safety risks.
  • โ€”๐Ÿ“ฆ Warehouse / Retail: Multi-user spatial coordination.

3. Dynamic Physics & Visibility

  • โ€”Lighting Models: bright, dim, outdoor_day, outdoor_night. Reduced visibility scales the gaze-alignment reward, forcing agents to find better-lit placement zones.
  • โ€”Dynamic Elements: AI-controlled pedestrians and vehicles that agents must detect and avoid to maintain safety scores.

๐Ÿ“ˆ Baseline Performance

Evaluated on Qwen2.5-72B-Instruct via Hugging Face Router.

TaskLevelAvg. RewardSuccess RateKey Challenges
Task 1Easy0.73100%FOV alignment
Task 2Medium0.6766%Furniture collisions
Task 3Hard0.340%Multi-user & Low Light

๐Ÿ› ๏ธ Installation & Usage

1. Local Setup

bash
pip install -r requirements.txt
python -m uvicorn api.server:app --port 7860

2. Run Inference Loop

bash
# Set HF token in .env or shell
python inference.py

3. API Sample

Place a virtual_screen on a wall:

json
POST /step
{
  "action_type": "place",
  "position": [2.5, 1.5, 3.0],
  "anchor_type": "world_locked",
  "anchor_surface_id": "wall_n"
}

โš–๏ธ Reward Function

The environment provides a dense, shaped reward in the range [0, 1]:

$$R = \sum (wi \cdot si) - \text{Penalties} + \text{AnchorBonus}$$

  • โ€”AnchorBonus: +0.10 for stable anchoring (e.g. Head-locked for Notifications).
  • โ€”Visibility Scaler: Gaze alignment is multiplied by the environment light factor.
  • โ€”Comfort Zone: Objects must lie within the user's 45ยฐ ergonomic cone.

๐Ÿ“ Compliance

  • โ€”OpenEnv Compatible: Fully passes openenv validate.
  • โ€”FastAPI Standard: Native Pydantic v2 validation.
  • โ€”Licensing: Open-source MIT.