Suppose data is organized like this:
- Satellite image YOLOv3 cfg and model are in data/yolov3/
- Streetview YOLOv3 cfg and model are in data/yolov3sv/
- Satellite image dataset CSVs are e.g. data/dataset/train_df.csv and images are data/dataset/training_v1/...
- Labels annotated from satellite image + streetview are at data/manual41.json
- la.graph is in data/la.graph (generated by road-network/mkgraph.go)
First, apply YOLOv3 model on satellite images (test set):
# first need to setup modified version of darknet from https://github.com/uakfdotb/darknet
# (modification is one line change to print the bounding box to stdout)
ln -s /path/to/darknet darknet
# the run-yolo scripts need absolute path to yolov3 cfg, model, and images
go run run-yolo-json.go /path/to/data/yolov3/yolov3.cfg /path/to/data/yolov3/yolov3.best /path/to/data/dataset/ test sat-output.json
python3 test.py data/manual41.json sat-output.json data/dataset/test_df.csv
Next, threshold the detections and convert them from pixel coordinates to longitude-latitude. This is needed to fetch images from streetview API.
python3 json-scripts/filter-prob.py sat-output.json 10 sat-output-thresholded.json
go run json-scripts/output_to_lonlat.go data/dataset/training_v1.csv sat-output-thresholded.json sat-output-thresholded-lonlat.json
Now we can fetch a few streetview images for each street light detection:
mkdir sv-images/
go run get-streetview/get-some-streetview4.go sat-output-thresholded-lonlat.json data/la.graph [Google API Key] sv-images/
And then run YOLOv3 on streetview:
go run run-streetview-yolo4.go /path/to/data/yolov3sv/yolov3.cfg /path/to/data/yolov3sv/yolov3.best /path/to/sv-images/ sv-detections.json
python get-streetview/streetview_integrate_clean.py sat-output-thresholded.json sv-detections.json sv-images/ data/dataset/training_v1.csv final.json
python3 test.py data/manual41.json final.json data/dataset/test_df.csv