Skip to content
This repository has been archived by the owner on Jul 2, 2019. It is now read-only.

Spacenet poi merge #21

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9dee579
added createSpaceNetPOI.py for processing Raw Imagery and Point of In…
Apr 13, 2017
a4aaffc
moved pointOfInterestList to JSON file for use accross functions
Apr 13, 2017
55854e2
modified labeltools/geoTools to support loading of JSON with dictiona…
Apr 13, 2017
4b2f123
modified createDataSpaceNet.py to read json for config
Apr 13, 2017
7abe0ce
added python/createSpaceNetPOI.py capability to no sort images by cla…
Apr 13, 2017
08b14e8
fixed simple error in gdalRasterizeLayer attribute=c;assid. Must be …
Apr 13, 2017
8a87409
removed raising error if featureName is not recognized
Apr 13, 2017
99d838c
fixed omitted createDataSpaceNet.py
Apr 13, 2017
6724100
updated createDataSpaceNet.py to support DARKNET POI testing
Apr 13, 2017
fcf63cf
updated geoTools.py so that featureId number is featureIdNUm
Apr 13, 2017
8360a7c
updated featureBBoxSizeM for better fit
Apr 17, 2017
71c283a
updated createSpaceNetPOI.py to do train/test split by region
Apr 18, 2017
b78189d
updated createSpaceNetPOI.py to do train/test split, fixed error
Apr 18, 2017
6d98ba8
updated createSpaceNetPOI.py to do train/test split, Add minPartail t…
Apr 18, 2017
3316b6b
added deduplication feature using geopandas
Apr 19, 2017
d2c0ff1
removed python/cleangeoJson.py it was scratch
Apr 19, 2017
bdcadfe
added updated Dockerfile to install geopandas
Apr 19, 2017
49690bc
specified encoding type = utf-8 for geopandas read in and out. Necce…
Apr 20, 2017
cb29bae
udpated splitVector for Test Traint to now give bounding box to include
Apr 20, 2017
78f7527
remerge of spacenetBaseline into spacenetPOI
May 17, 2017
2bb86fb
modified externatlVectorProcessing.py for OSM usage
May 18, 2017
b2edd0c
update geoTools.py
May 18, 2017
8ff46af
Merge pull request #2 from dlindenbaum/master
dlindenbaum Jul 15, 2017
edbad36
mid status geoToolsGPD.py update
Aug 13, 2017
ef0ae9e
updates to geopandas support
Aug 21, 2017
707c8ed
modified files for python3 compatiability and fiona/rasterio use
Sep 10, 2017
8284173
added cw_environment.yml for conda install
Sep 10, 2017
cd89e6f
created osmtools.py
Sep 10, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions configFiles/AOI_1_Rio_POI_Description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"Airfield_POIApron Lights Tower": {
"featureIdNum": 1,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10
},
"Airfield_POIHangar": {
"featureIdNum": 2,
"featureChipScaleM": 200,
"featureBBoxSizeM": 25
},
"Airfield_POIHelipad": {
"featureIdNum": 3,
"featureChipScaleM": 200,
"featureBBoxSizeM": 18
},
"Airfield_POISupport Facility": {
"featureIdNum": 4,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10
},
"Bridges_TunnelsBridgePedestrian": {
"featureIdNum": 5,
"featureChipScaleM": 200,
"featureBBoxSizeM": 20
},
"Bridges_TunnelsBridgeRoad": {
"featureIdNum": 6,
"featureChipScaleM": 200,
"featureBBoxSizeM": 20
},
"Commercial_POIServiceBar": {
"featureIdNum": 7,
"featureChipScaleM": 200,
"featureBBoxSizeM": 25
},
"Electrical_POITransmission Tower": {
"featureIdNum": 8,
"featureChipScaleM": 200,
"featureBBoxSizeM": 12
},
"EmbassiesConsulate": {
"featureIdNum": 9,
"featureChipScaleM": 200,
"featureBBoxSizeM": 25
},
"Olympic_Venues": {
"featureIdNum": 10,
"featureChipScaleM": 200,
"featureBBoxSizeM": 50
},
"Public_Transportation_POIBusStop": {
"featureIdNum": 11,
"featureChipScaleM": 200,
"featureBBoxSizeM": 5
},
"Railways_POI999999Station": {
"featureIdNum": 12,
"featureChipScaleM": 200,
"featureBBoxSizeM": 25
},
"Recreation_POIPark": {
"featureIdNum": 13,
"featureChipScaleM": 200,
"featureBBoxSizeM": 50
},
"Recreation_POIPool": {
"featureIdNum": 14,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10
},
"Recreation_POISports Facility": {
"featureIdNum": 15,
"featureChipScaleM": 200,
"featureBBoxSizeM": 30
},
"Religious_InstitutionsChurch": {
"featureIdNum": 16,
"featureChipScaleM": 200,
"featureBBoxSizeM": 25
}
}


83 changes: 83 additions & 0 deletions configFiles/OSM_Power.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"power":
{
"compensator": {
"featureIdNum": 1,
"featureChipScaleM": 200,
"featureBBoxSizeM": 5,
"spaceFeatureName": "power:compensator"
},
"converter": {
"featureIdNum": 2,
"featureChipScaleM": 200,
"featureBBoxSizeM": 5,
"spaceFeatureName": "power:converter"
},
"heliostat": {
"featureIdNum": 3,
"featureChipScaleM": 200,
"featureBBoxSizeM": 5,
"spaceFeatureName": "power:heliostat"
},
"insulator": {
"featureIdNum": 4,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10,
"spaceFeatureName": "power:insualtor"
},
"pole": {
"featureIdNum": 5,
"featureChipScaleM": 200,
"featureBBoxSizeM": 5,
"spaceFeatureName": "power:pole"
},
"portal": {
"featureIdNum": 6,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10,
"spaceFeatureName": "power:portal"
},
"catenary_mast": {
"featureIdNum": 7,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10,
"spaceFeatureName": "power:catenary_mast"
},
"substation": {
"featureIdNum": 8,
"featureChipScaleM": 200,
"featureBBoxSizeM": 25,
"spaceFeatureName": "power:substation"
},
"switch": {
"featureIdNum": 9,
"featureChipScaleM": 200,
"featureBBoxSizeM": 5,
"spaceFeatureName": "power:switch"
},
"terminal": {
"featureIdNum": 10,
"featureChipScaleM": 200,
"featureBBoxSizeM": 5,
"spaceFeatureName": "power:terminal"
},
"tower": {
"featureIdNum": 11,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10,
"spaceFeatureName": "power:tower"
},
"transformer": {
"featureIdNum": 12,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10,
"spaceFeatureName": "power:transformer"
},
"unknown": {
"featureIdNum": 13,
"featureChipScaleM": 200,
"featureBBoxSizeM": 10,
"spaceFeatureName": "power:unknown"
}
}
}
Binary file modified content/.DS_Store
Binary file not shown.
59 changes: 59 additions & 0 deletions cw_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: cw_environment
channels:
- conda-forge
- defaults
dependencies:
- cython
- libgdal=2.2.1
- numpy
- opencv=3.2.0=np113py36_blas_openblas_204
- pip=9.0.1=py36_0
- pyproj
- pytables
- python=3.6.2=0
- python-dateutil=2.6.1=py36_0
- pytz=2017.2=py36_0
- pywavelets=0.5.2=np113py36_0
- pyyaml=3.12=py36_1
- readline=6.2=0
- requests=2.18.4=py36_1
- scikit-image
- scikit-learn
- scipy
- setuptools=36.2.2=py36_0
- six=1.10.0=py36_1
- sortedcontainers=1.5.7=py36_0
- sqlite=3.13.0=1
- tblib=1.3.2=py36_0
- tk=8.5.19=2
- toolz=0.8.2=py36_0
- tornado=4.5.1=py36_0
- urllib3=1.22=py36_0
- wheel=0.29.0=py36_0
- x264=20131217=3
- xerces-c=3.1.4=3
- xz=5.2.3=0
- yaml=0.1.6=0
- zict=0.1.2=py36_0
- zlib=1.2.11=0
- pip:
- affine==2.1.0
- boto3==1.4.6
- botocore==1.6.8
- click-plugins==1.0.3
- cligj==0.4.0
- descartes==1.1.0
- docutils==0.14
- fiona==1.7.9.post1
- geopandas==0.2.1
- jmespath==0.9.3
- keras==1.1.0
- munch==2.2.0
- pathlib
- rasterio==1.0a9
- s3transfer==0.1.10
- shapely==1.6.0
- snuggs==1.4.1
- tables==3.4.2
- theano==0.9.0
- tqdm
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN pip install rtree

## Install Python requirements

RUN pip install pandas geopandas


ENV GIT_BASE=/opt/
WORKDIR $GIT_BASE

Expand Down
1 change: 1 addition & 0 deletions docker/standalone/cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ RUN pip install rtree

RUN pip install pandas geopandas


ENV GIT_BASE=/opt/
WORKDIR $GIT_BASE

Expand Down
1 change: 1 addition & 0 deletions docker/standalone/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RUN pip install rtree

RUN pip install pandas geopandas


ENV GIT_BASE=/opt/
WORKDIR $GIT_BASE

Expand Down
37 changes: 30 additions & 7 deletions python/createDataSpaceNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from spaceNetUtilities import labelTools as lT
from spaceNetUtilities import geoTools as gT
import argparse
import json


def processRasterChip(rasterImage, rasterDescription, geojson, geojsonDescription, outputDirectory='',
Expand Down Expand Up @@ -53,7 +54,9 @@ def processChipSummaryList(chipSummaryList, outputDirectory='', annotationType='
outputPixType='',
datasetName='spacenetV2',
folder_name='folder_name',
bboxResize=1.0
bboxResize=1.0,
objectClassDict='',
attributeName=''
):

if outputPixType == '':
Expand Down Expand Up @@ -82,7 +85,9 @@ def processChipSummaryList(chipSummaryList, outputDirectory='', annotationType='
convertTo8Bit=convertTo8Bit,
outputPixType=outputPixType,
outputFormat=outputFormat,
bboxResize=bboxResize
bboxResize=bboxResize,
objectClassDict=objectClassDict,
attributeName=attributeName
)
elif annotationType=='DARKNET':
entry = lT.geoJsonToDARKNET(annotationName, chipSummary['geoVectorName'], chipSummary['rasterSource'],
Expand All @@ -92,7 +97,9 @@ def processChipSummaryList(chipSummaryList, outputDirectory='', annotationType='
convertTo8Bit=convertTo8Bit,
outputPixType=outputPixType,
outputFormat=outputFormat,
bboxResize=bboxResize
bboxResize=bboxResize,
objectClassDict=objectClassDict,
attributeName=attributeName
)

elif annotationType=='SBD':
Expand Down Expand Up @@ -221,7 +228,7 @@ def createTrainTestSplitSummary(entryList, trainTestSplit=0.8,
action='store_true')
parser.add_argument("--featureName",
help='Type of feature to be summarized by csv (i.e. Building)'
'Currently in SpaceNet V2 Building is only label',
'Currently in SpaceNet V2 Building is the only label',
type=str,
default='Buildings')
parser.add_argument("--spacenetVersion",
Expand All @@ -240,6 +247,12 @@ def createTrainTestSplitSummary(entryList, trainTestSplit=0.8,
type=float,
default=1.0)

parser.add_argument("--POIConfigJson",
help='JSON file containing information about valid Points of interest',
default='')
parser.add_argument("--attributeName",
help='Attribute in GeoJson to pull the feature name from',
default='spacenetFeature')
args = parser.parse_args()

entryList = []
Expand All @@ -256,7 +269,7 @@ def createTrainTestSplitSummary(entryList, trainTestSplit=0.8,
geojsonDirectory = os.path.join('vectordata','geojson')
# 'vectordata/geojson'
else:
print('Bad Spacenet Version Submitted, Version {} is not supported'.foramt(args.spacenetVersion))
print('Bad Spacenet Version Submitted, Version {} is not supported'.format(args.spacenetVersion))

if args.convertTo8Bit:

Expand All @@ -272,11 +285,19 @@ def createTrainTestSplitSummary(entryList, trainTestSplit=0.8,
else:
fullPathAnnotationsDirectory = args.outputDirectory

if args.POIConfigJson == '':
objectClassDict=''
else:

with open(args.POIConfigJson, 'r') as f:
objectClassDict = json.load(f)

for aoiSubDir in listOfAOIs:
fullPathSubDir = os.path.join(srcSpaceNetDirectory, aoiSubDir)

## Create Annotations directory
#fullPathAnnotationsDirectory = os.path.join(fullPathSubDir, annotationsDirectory)
## fullPathAnnotationsDirectory = os.path.join(fullPathSubDir, annotationsDirectory)

if not os.path.exists(fullPathAnnotationsDirectory):
os.makedirs(fullPathAnnotationsDirectory)
if not os.path.exists(os.path.join(fullPathAnnotationsDirectory, 'annotations')):
Expand Down Expand Up @@ -314,7 +335,9 @@ def createTrainTestSplitSummary(entryList, trainTestSplit=0.8,
outputPixType=outputDataType,
datasetName='spacenetV2',
folder_name='folder_name',
bboxResize= args.boundingBoxResize
bboxResize= args.boundingBoxResize,
objectClassDict=objectClassDict,
attributeName=args.attributeName
)
print(entryListTmp)
entryList.extend(entryListTmp)
Expand Down
Loading