Views
No views yet
task = building-detection
1import { geoai } from "geoai";
2
3// Example polygon (GeoJSON)
4const polygon = {
5 type: "Feature",
6 properties: {},
7 geometry: {
8 coordinates: [
9 [
10 [-117.59239617156095, 47.653614113446906],
11 [-117.59239617156095, 47.652878388765174],
12 [-117.59040545822742, 47.652878388765174],
13 [-117.59040545822742, 47.653614113446906],
14 [-117.59239617156095, 47.653614113446906]
15 ],
16 ],
17 type: "Polygon",
18 },
19} as GeoJSON.Feature;
20
21// Initialize pipeline
22const pipeline = await geoai.pipeline(
23 [{ task: "building-detection" }],
24 providerParams
25);
26
27// Run detection
28const result = await pipeline.inference({
29 inputs: { polygon }
30});
31
32// Sample output format
33// {
34// "detections": {
35// "type": "FeatureCollection",
36// "features": [
37// {
38// "type": "Feature",
39// "properties": {
40// },
41// "geometry": {
42// "type": "Polygon",
43// "coordinates": [
44// [
45// [54.69479163045772, 24.766579711184693],
46// [54.69521093930892, 24.766579711184693],
47// [54.69521093930892, 24.766203991224682],
48// [54.69479163045772, 24.766203991224682],
49// [54.69479163045772, 24.766579711184693],
50// ]
51// ]
52// }
53// },
54// {"type": 'Feature', "properties": {…}, "geometry": {…}},
55// {"type": 'Feature', "properties": {…}, "geometry": {…}},
56// ]
57// },
58// "geoRawImage": GeoRawImage {data: Uint8ClampedArray(1048576), width: 512, height: 512, channels: 4, bounds: {…}, …}
59// }
60