Using Cycloramas to Find Street Furniture
At the Mayor's Office I was asked to find manhole covers and fire hydrants. I started off using aerial imagery, but I did not have a good data source that accurately tagged the data. Also, even with 6-inch resolution, it was difficult to detect manhole covers, which in NYC are the same black color as the asphalt.
I switched to Cyclomedia's data to predict street furniture using the YOLOv8 model. Cyclomedia drives around and takes a "cyclorama", like a panoramic image from the truck. One benefit of the cyclorama is that they have LIDAR coordinates to accurately geolocate the center pixel of the predicted bounding box.
Detecting Fire Hydrants
The YOLOv8 model is very good at detection of street furniture with low overhead. It is trained on Microsoft's COCO dataset which comes pre-trained for street furniture, such as traffic lights, fire hydrants, and stop signs, as well as other road things like cars, trucks, and motorcycles. I did some preliminary investigation.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from ultralytics import YOLO from ultralytics.utils.plotting import Annotator mypath = Path("/content") / 'drive' / 'My Drive' model = YOLO("yolov8x.pt") img_path = img2_path img = cv2.imread(img_path) results = model.predict(img, conf=0.7) cv2_imshow(img) for r in results: annotator = Annotator(img) boxes = r.boxes for box in boxes: b = box.xyxy[0] #left, top, right, bottom cen = box.xywh[0] x = int(cen.cpu().numpy()[0]) y = int(cen.cpu().numpy()[1]) c = box.cls annotator.box_label(b, f'{model.names[int(c)]}, {x, y}' ) #draw bounting box and label img = annotator.result() cv2_imshow(img) |
Fire Hydrant Results
The model successfully identified the black fire hydrant, at a distance, and even distinguished it from the similar white-capped bollards.


Not bad for right out of the box! YOLOv8 seems ready to go.
Detecting Maholes
Manholes are not in the COCO Dataset, they would need to be trained. So I looked on Roboflow for something similar and found a dataset called 'hatch'. The dataset was intended to distinguish between open and closed hatches. I pruned the dataset to include reduce the non-manhole hatches. Some were open, some were closed. The final training dataset had 11,673 images, about 2 of every 3 were augmentations of the original.
|
1 2 3 4 5 6 7 8 9 10 11 |
results = model.train(data='ROOT / training_data/hatch.v1i.yolov8/data.yaml', pretrained=True, epochs=300, patience=15, batch=-1, imgsz=640, cache=True, device=0, plots=True, ) model.save("trained_model.pt) |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
57 epochs completed in 1.582 hours. Optimizer stripped from runs/detect/train8/weights/last.pt, 136.7MB Optimizer stripped from runs/detect/train8/weights/best.pt, 136.7MB Validating runs/detect/train8/weights/best.pt... Ultralytics YOLOv8.1.28 🚀 Python-3.11.7 torch-2.2.1+cu121 CUDA:0 (NVIDIA GeForce RTX 4090, 24564MiB) Model summary (fused): 268 layers, 68125494 parameters, 0 gradients, 257.4 GFLOPs Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| all 655 717 0.759 0.705 0.757 0.584 close_hatch 655 403 0.712 0.71 0.757 0.585 open_hatch 655 314 0.806 0.7 0.756 0.583 Speed: 0.1ms preprocess, 4.8ms inference, 0.0ms loss, 0.6ms postprocess per image |

The training took 1.58 hours and 57 epochs. I set the "patience" setting to 15, so there was no improvement for 15 epochs before the job terminated. This model was the best of all epochs.
It made some mistakes. the mean Average Precsion is 75.6%. A close hatch was not identified 34.6% of the time, and was interpreted as a closed hatch 21.0% of the time. We are primarily looking for closed hatches.

Manhole Results
The results were mixed when I applied this training data to NYC cyclomedia data.



It did not like matte black manholes, manholes that were too far away, or manholes that were too small. In the third image it failed to detect at least two obvious manholes. The training data was generally closer taken by a pedestrian with a cell phone, and cropped to 640 x 640. The cyclorama data is not from a vehicle, further away, at an angle taken on top of a car, and the objects are a wider variety of scales.
Further Research
The next step would be to go through the New York City cycloramas, split them into 640x640 tiles and manually tag the manholes for training. I would need workers to do the tagging (I don't have time), funds for a pro-version of RoboFlow, and and access to large number of cycloramas. That is as far as I can take the manhole project now, but I am confident we could deploy the fire hydrants computer vision now, if I get access to the raw cycloramas.
Leave A Reply