Skip to content

Instantly share code, notes, and snippets.

boxes, masks, seg_scores = im_detect(im, net)
def im_detect(im, net):
forward_kwargs, im_scales = prepare_mnc_args(im, net)
blobs_out = net.forward(**forward_kwargs)
rois_phase1 = net.blobs['rois'].data.copy()
masks_phase1 = net.blobs['mask_proposal'].data[...]
scores_phase1 = net.blobs['seg_cls_prob'].data[...]
rois_phase2 = net.blobs['rois_ext'].data[...]
masks_phase2 = net.blobs['mask_proposal_ext'].data[...]
test_prototxt = 'MNC/models/VGG16/mnc_5stage/test.prototxt'
test_model = 'MNC/output/mnc_5stage/voc_2012_train/vgg16_mnc_5stage_iter_25000.caffemodel.h5'
caffe.set_mode_gpu()
caffe.set_device(0)
cfg.GPU_ID = 0
net = caffe.Net(test_prototxt, test_model, caffe.TEST)
@lncohn
lncohn / labels_command
Created March 14, 2017 17:30
labels command
python spacenet_labels_dir_to_voc_labels_dir.py raster_dir vector_dir cls_dir inst_dir
@lncohn
lncohn / spacenet_label_geojson
Created March 14, 2017 16:53
SpaceNet Geojson Label
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "timestamp": "2016-07-14T19:08:20Z", "version": "1", "changeset": "11494", "user": "knash", "uid": "1099", "HGIS_OID": "None", "building": "yes", "type": "None", "id": "way\/446421", "area": "None", "QAStatus": "New_Building_Rev1", "HGISOID": 0.000000, "TaskArea": "West", "Revision1": "Yes", "Shape_Leng": 0.000466, "Shape_Area": 0.000000, "partialBuilding": 1.000000, "partialDec": 0.000757 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -43.642018379893813, -22.98005822672528, 0.0 ], [ -43.642018399999984, -22.980057899999963, 0.0 ], [ -43.642005550042619, -22.980057219554151, 0.0 ], [ -43.642005550042619, -22.98005822672528, 0.0 ], [ -43.642018379893813, -22.98005822672528, 0.0 ] ] ] } }
]
}
@lncohn
lncohn / scalacheatsheet.md
Created June 29, 2016 13:48
Scala Cheat Sheet

Cheat Sheet

This cheat sheet originated from the forum, credits to Laurent Poulain. We copied it and changed or added a few things.

Evaluation Rules

  • Call by value: evaluates the function arguments before calling the function
  • Call by name: evaluates the function first, and then evaluates the arguments if need be