Skip to content

Instantly share code, notes, and snippets.

View suyashgupta25's full-sized avatar

Suyash Gupta suyashgupta25

View GitHub Profile
pip install turicreate
# Include module turicreate
import turicreate as tc
# Define all painting images annotations with bounding box details (I am showing only 5)
annotations = tc.SArray([
[
{'label': 'painting1', 'type': 'rectangle', 'coordinates': {'height': 725, 'width': 625, 'x': 736, 'y': 636}}
],
[
{'label': 'painting2', 'type': 'rectangle', 'coordinates': {'height': 735, 'width': 661, 'x': 396, 'y': 568}}
let visionModel = try? VNCoreMLModel(for: Painting.model)
let classificationRequest = VNCoreMLRequest(model:visionModel, completionHandler: handleDetections)
// make a global variable in your UIViewCOntroller : var requests = [VNRequest]()
self.requests = [classificationRequest]
let pixbuff : CVPixelBuffer? = (sceneView.session.currentFrame?.capturedImage)
let imageRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixbuff!, orientation: CGImagePropertyOrientation.right, options: [:])
// Run Image Request
do {
if requests.count > 0 {
try imageRequestHandler.perform(self.requests)
}
} catch {
print(error)
}
hdiutil resize -size <new-size-you-want>g ~/android.dmg.sparseimage
xcode-select --install
POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg