floor_seg: drivable floor segmentation for a small indoor robot
Per-pixel drivable floor vs. not floor from a camera close to the floor, small enough to run on a
Raspberry Pi CM4 (Reachy Mini) at ~9 Hz in fp32 with ONNX Runtime. Trained only on synthetic renders.
This release is the development model v10c_crossdoor.
- Architecture: LR-ASPP head on a MobileNetV3-Small backbone (torchvision), 1.08 M parameters.
- Input: 1 x 3 x 192 x 320, RGB, scaled to 0..1 then ImageNet-normalized (mean 0.485 0.456 0.406, std 0.229 0.224 0.225); resize the camera frame with area interpolation.
- Output: 1 x 3 x 192 x 320 logits. Channels 0-1: not floor / floor. Channel 2: "under" logit (sigmoid > 0.5: this floor pixel has something lower than 0.45 m above it, e.g. under a bed or a chair; meaningful on floor pixels only).
- Decision used on the robot: floor where softmax(logits[0:2])[1] > 0.7 (equivalently
logit[1] - logit[0] > ln(0.7 / 0.3)); under where sigmoid(logit[2]) > 0.5. - Files:
model.safetensors+config.json(PyTorch,floor_seg.model.FloorNet),floor.onnx(fp32, opset 17, inputinput, outputlogits),metrics.jsonl(synthetic validation per epoch),floor_rk3566_fp16.rknn(Rockchip RK3566 NPU, fp16; see below). - Code (training, rendering, evaluation): https://github.com/pollen-robotics/floor_seg
Label definition
A pixel is floor if its 3D point is at most 1 cm above the floor plane. Anything higher is an obstacle: walls, plinths / skirting boards, furniture, objects. Cables, door thresholds, rug edges and rug surfaces count as floor. The model says where the floor is visible; overhangs (table tops, chair seats) are only "not floor" where they hide the floor. The "under" output marks visible floor below such overhangs.
Training data
All synthetic, rendered from the robot's viewpoint (camera 0.25-0.55 m above the floor) through the calibrated Reachy Mini lens:
- ProcTHOR-10K houses rendered with AI2-THOR:
thor_v1(9,929 views, 1,996 houses) andthor_v4(11,196 views; clutter on the floor, the "under" mask, rendered plinths along the walls). - Infinigen indoor scenes:
infinigen_v1(805 views, 163 rooms),infinigen_v2(4,982 views, 998 rooms, houses with doors and thresholds, many floor materials) andinfinigen_v3(views across doorways into a room with another flooring, often brighter). - Training-time floor retexturing: photo textures from ambientCG (CC0), procedural tiles, rugs, sun patches and glare, laid on the floor plane in perspective using the rendered depth; plinth recolouring; threshold strips in doorways; a brightness step beyond a line on the floor.
- Camera-like augmentation: colour / gamma, noise, defocus and motion blur, JPEG, zoom-crop, flip, roll +-15 deg.
- 30 epochs, AdamW, one-cycle LR, mixed precision; best epoch by synthetic validation floor IoU. Validation = houses / rooms never trained on.
- Backbone initialised from torchvision's ImageNet-1k MobileNetV3-Small weights (see Licensing notes).
The training renders are not published yet.
Results
Metrics are pooled over pixels. False floor = obstacle pixels predicted as floor / obstacle pixels (the error that drives the robot into things). Missed floor = floor pixels predicted as not floor / floor pixels. Base band false floor = false floor on the obstacle pixels 4-20 px above the floor edge (plinths, furniture feet, door frames): the part of the obstacle the robot meets first.
Synthetic validation: floor IoU 0.950, false floor 2.0 %, missed floor 2.4 % (cutoff 0.5).
Real frames (150, Reachy Mini camera on a wheeled base, several runs in one home; labels from SAM2 regions with manual review; private, not released):
| Set (frames) | Cutoff | Floor IoU | False floor | Missed floor | Base band false floor |
|---|---|---|---|---|---|
| all (150) | 0.5 | 0.963 | 2.2 % | 1.4 % | 13.3 % |
| all (150) | 0.7 | 0.961 | 1.3 % | 2.7 % | 7.4 % |
| general driving (75) | 0.7 | 0.962 | 1.1 % | 2.8 % | 5.4 % |
| doorsteps (16) | 0.7 | 0.965 | 2.0 % | 2.1 % | 10.7 % |
| kitchen doorstep (17) | 0.7 | 0.953 | 1.9 % | 2.9 % | 13.3 % |
| plinths and toe-kicks (42) | 0.7 | 0.960 | 1.1 % | 2.6 % | 7.2 % |
On-robot cost (Raspberry Pi CM4, fp32 ONNX Runtime CPU, 1 thread, intra-op spinning off): ~90 ms inference
(median), ~9 Hz with resize and normalization. Leave ONNX Runtime's thread spinning off
(session.intra_op.allow_spinning = 0): it costs ~0.45 core extra.
Usage
import cv2, numpy as np, onnxruntime as ort
from huggingface_hub import hf_hub_download
so = ort.SessionOptions()
so.intra_op_num_threads = 1
so.add_session_config_entry("session.intra_op.allow_spinning", "0")
sess = ort.InferenceSession(hf_hub_download("pollen-robotics/floor_seg", "floor.onnx"), so,
providers=["CPUExecutionProvider"])
bgr = cv2.imread("frame.jpg")
x = cv2.resize(bgr, (320, 192), interpolation=cv2.INTER_AREA)[:, :, ::-1].astype(np.float32) / 255
x = ((x - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]).astype(np.float32).transpose(2, 0, 1)[None]
z = sess.run(None, {"input": x})[0][0]
floor = (z[1] - z[0]) > np.log(0.7 / 0.3) # 192 x 320 bool
under = floor & (z[2] > 0) # floor with something low above it
PyTorch: from floor_seg.model import FloorNet; model = FloorNet.from_pretrained("pollen-robotics/floor_seg", pretrained_backbone=False).eval()
(or floor_seg.model.load_torch(repo_id)).
Rockchip RK3566 NPU (floor_rk3566_fp16.rknn)
floor_rk3566_fp16.rknn is this floor.onnx converted for the RK3566 NPU in fp16 (no
quantization), with rknn-toolkit2 2.3.2, target_platform="rk3566". The ImageNet normalization is
built in: feed it raw RGB bytes, 1 x 192 x 320 x 3 (NHWC, uint8), and it returns the same 1 x 3 x 192 x 320
logits as floor.onnx, read the same way. It needs RKNN runtime 2.3.x on the board.
Measured on a Pollen microduck (RK3566, NPU runtime 2.3.2, driver 0.9.8) on 60 frames of the robot's own camera, at 5 Hz:
| Backend | Inference p50 / p95 | CPU time per frame in the call | Mask agreement with fp32 CPU |
|---|---|---|---|
| fp32 ONNX Runtime, CPU, 2 threads | 87 / 96 ms | 146 ms | reference |
fp16 NPU (floor_rk3566_fp16.rknn) |
38 / 40 ms | 11 ms | IoU 1.000 |
| int8 NPU (mmse calibration, not published) | 21 / 23 ms | 3 ms | IoU 0.946, false floor up to 10 % of a frame |
int8 was faster but called dark objects on the floor and the base of walls floor, consistent with the int8 note under Limitations, so only fp16 is published.
Intended use
Near-field free-space detection for a small indoor robot (Reachy Mini on a mobile base) in homes: which floor pixels in front of the robot are free, to feed a local obstacle map or a safety filter. Not a safety-certified component: use it with a planner safety margin and other safeguards.
Limitations
- Base of obstacles: most remaining false floor is in the first centimetres above the floor (plinths, toe-kicks, furniture feet): 7 % of those pixels at cutoff 0.7.
- Flat obstacles 1-3 cm high (board edges, bath mats on duckboards) are often called floor.
- Overhangs are not represented at their height: table tops and chair seats are only "not floor" where they hide the floor ("under" marks the floor below them).
- Far floor seen at grazing angles (> 1-1.5 m) tends to be marked not floor (over-cautious).
- Trained on synthetic data only; evaluated on 150 real frames from one home.
- int8 post-training quantization breaks the model (tested on an earlier version: ONNX Runtime static QDQ, several calibrations; real IoU 0.68 vs 0.89 in fp32). Use fp32.
- Tuned to the Reachy Mini camera (wide-angle lens, 16:9, 0.25-0.55 m above the floor, pitch -5 to 29 deg). Other cameras or viewpoints are out of distribution.
Licensing notes
- Code and weights: Apache-2.0.
- Training data: ProcTHOR-10K and AI2-THOR (Apache-2.0, Allen Institute for AI); Infinigen (BSD-3-Clause, Princeton Vision & Learning Lab); ambientCG textures (CC0).
- Open point (not decided): the backbone was initialised from torchvision's ImageNet-1k pretrained MobileNetV3-Small weights. torchvision code is BSD-3-Clause, but ImageNet images come with non-commercial research terms, and whether weights trained on them inherit those terms is a known grey area for commercial use. Alternative if needed: retrain from scratch or from a backbone pretrained on commercially licensed data.
Citation / attribution
- Deitke et al., "ProcTHOR: Large-Scale Embodied AI Using Procedural Generation", NeurIPS 2022.
- Kolve et al., "AI2-THOR: An Interactive 3D Environment for Visual AI", 2017.
- Raistrick et al., "Infinigen Indoors: Photorealistic Indoor Scenes using Procedural Generation", CVPR 2024.
- Howard et al., "Searching for MobileNetV3", ICCV 2019 (MobileNetV3 and LR-ASPP).
- ambientCG (https://ambientcg.com), CC0 textures.
- Downloads last month
- 27