KWCoco
KWCoco
How it started, and how it’s going
2021-02-05 - how it started
2022-04-06 - how it’s going
2023-11-29 - how it’s still going
KWCOCO
Assets 3
Assets 2
Assets 1
Video
Img 1
Img 2
Img 3
R|G|B
b3
Videos:
Assets:
Images:
pan
pan
R|G|B
b8
f1
f2
Annots
Annots
Annots
Annotations:
KWCOCO For SMART
Assets 3
Assets 2
Assets 1
Video
Img 1
Img 2
Img 3
R|G|B
b3
pan
pan
R|G|B
b8
f1
f2
Annots
Annots
Annots
KWCOCO (tracking)
MS-COCO modified to support simple tracking:�
Assets 3
Assets 2
Assets 1
Video
Img 1
Img 2
Img 3
R|G|B
Annots
Annots
Annots
R|G|B
R|G|B
depth
IR
<track_id>
<track_id>
<track_id>
Motivation
KWCOCO
Pycocotools
KWCOCO CLI
Demo Data
Default Dictionary Backend
Note on notation: a = Annotation, c = Category, g = imaGe, vid = video (e.g. aid = annotation id, gid = image id)
Example JSON data structure
Vectorized interface
Convenience accessors are provided to allow for accessing multiple attributes with minimal code.
dset.images(<gids>)�dset.annots(<aids>)�dset.videos(<vidids>)�dset.categories(<cids>)
Experimental SQLAlchemy Backend
SQL Scaling
NDSampler
NDSampler -
Training a 224x224 Resnet50 Classifier on �Annotations in 1080x1920 images
With Cog
~80-95ish% constant utilization)
Without CoG
(67Hz @ 3x224x224)
With Cog
(best worker count = 4 )
(19.4GB RAM per worker)
Without Cog
With Cog
(best worker count > 12 )
(42GB RAM per worker!)
Without Cog
Jumps between 0 and 100% utilization
With CoG
(654Hz / 3x224x224)
KWImage Data Structures�(may change to kwannot)��These all interface nicely with shapely
Overview
All structures have methods:
Core principle: Classes should be extremely thin wrappers around underlying numpy arrays
kwimage.structs.Boxes
kwimage.structs.Coords
kwimage.structs.Polygon
kwimage.Detections
KWArray
KWImage
KWImage - The Structures (kwannot?)
KWPlot
Somewhat related to kwcoco
Issues With Existing Machine Learning Systems
KWCOCO
New!
Visualizations of the an MSI kwcoco file.
Can load any set of channels as a “DelayedImage”, the finalize() operation loads and aligns the data at a specified resolution on the fly.
Note: Video corresponds a time sequence of images.
ToyData: Food for the CI
Toy Data is useful for developing, debugging, and running tests on CI! Separates data from algorithms. Because Drop1 (and all datasets we work with) are in the same format we can swap it in.
KW-COCO
32
Sample Data From Region at a Virtual Resolution
I want channels [B2, nir, Material1, Material2, B11] at 10 meter GSD from [0:100, 100:200] at frames [3, 7] in video “23KPQ_BR_Rio_R01”.
kwcoco + ndsampler
Here’s that (5,2,100,100) tensor and annotations in relative coordinates.
Adding Your Features to the KWCOCO file
{
"videos": [{"name": "TheRegionName", "width": 300, "height": 400}, ...],
"images": [
{
"name": "TheImageName",
"width": 600,
"height": 800,
"video_id": 1,
"date_captured": "2018-10-16T16:02:29",
"warp_img_to_vid": {"scale": 0.5},
"auxiliary": [
{
"file_name": "B1.tif",
"warp_aux_to_img": {"scale": 2.0},
"width": 300, "height": 400
"channels": "coastal", "num_bands": 1,
},
{
"file_name": "B2.tif",
"warp_aux_to_img": {"scale": 1.0},
"channels": "blue", "num_bands": 1,
},
...
], }, ... ]}
Input KWCOCO
...
"auxiliary": [
{"file_name": "B1.tif", ...},
{"file_name": "B2.tif", ...},
{
"file_name": "YOUR_FEATURE_PATH.tif",
"warp_aux_to_img": {"scale": 4.0},
"width": 75, "height": 100,
"channels": "your_channel_code",
"num_bands": 32,
...
},
...
]
Output KWCOCO
Append a new “auxiliary” item
Part 1: The kwcoco + ndsampler libraries
The kwcoco library
I truncated the segmentations
The data structure
The SQL Backend (don’t linger on this slide)
The ndsampler Library
Ndsampler API
Supporting Libraries
Part 2: The WATCH Datasets
Givens and Goals
???
LC
WV
S2
S2
LC
LC
WV
Gray (uint8)
TrueColor (uint8)
B1, B2, B3, B4, B5, B6, B7, B8, B8A B9, B10, B11
8 bands, unknown
Orthorectified Dataset
Method Overview
Raw GeoTiff Source
(e.g. RGD)
S2
LC
WV
S2
S2
LC
LC
WV
Orthorectified Naitive Resolution KWCoco
For each ROI-Query we:
S2
LC
WV
S2
S2
LC
LC
WV
Updated KWCoco at a Specified “Virtual” Resolution
watch/scripts/geojson_to_kwcoco.py
watch/scripts/coco_align_geotiffs.py
watch/scripts/coco_add_watch_fields.py
Important kwcoco Fields for WATCH
The updated “drop0-aligned” kwcoco dataset
Method summary
Part 3: In Domain Examples
The kwcoco API - compute stats on drop0
Scratch
Assets 2
Assets 1
Video
Img 1
Img 2
R|G|B
Annot 1
Annot 3
R|G|B
depth
Track1
Track2
Annot 2
Image
Asset
Annotation
Track
Video
*
*
*
*
Image
Asset
Annotation
Track
Video
*
*
*
*
Category
*
Info
Image
Asset
Annotation
Track
Video
*
*
*
*
Category
*
Info
🎵�Audio
? audio / mpeg structure to be determined.
MPEG
Image
Asset
Annotation
Track
Video
*
*
*
*
Category
*
Info
🎵�Audio
MPEG
🎵�Audio
MPEG
MPEG
MPEG
Annotation
The basic audio annotation is a 1D box, indicating start / end time. Label could be a category / caption / etc...
Image
Asset
Annotation
Track
Video
*
*
*
*
Category
*
Info
🎵�Audio
Movies
Stills