determine angle from image - training images / testing images
Closed this issue · 3 comments
I've been dabbling in this space for a couple of weeks. perhaps we can help each other.
I love how your code is very simple and elegant.
I see you haven’t included heavy frameworks and just cherry picked the needed code from Surge.
Keeping things simple.
I would say though - I'm getting some good mileage with EasyImagy (needs carthage) / it can build images by pixel arrays safely. I threw this code together(which is a mash up of other code) which builds out 1000 images / 1000 slopes on them. https://github.com/johndpope/Bresenham-Line/blob/master/Bresenham-Line/CMKViewController%2BNet.swift
working on integrating machine learning stuff slowly.
This question on stack overflow was original thought process for this work
https://stats.stackexchange.com/questions/218407/encoding-angle-data-for-neural-network
I think I have most of the ducks lined up - just need to correctly configure the neural network.
Given 1000 images - 101x101pixels - with an angle drawn and corresponding angle in another array - build a neural network to infer any angle.
I think 10201 neurons makes most sense to configure network.
let network = Network(layerStructure: [101x101,500,1], learningRate: 0.1)
I think I should be ok without any assistance. Just need to convert this python code to swift / then will do some performance testing
elif method == "gaussian": # Leaky binned encoding
X = array([i for i in range(500)])
idx = 250*(angle/pi + 1)
X = exp(-pi*(X-idx)**2)
Tried leveraging surge here -
https://github.com/johndpope/Bresenham-Line/blob/master/Bresenham-Line/CMKViewController%2BNet.swift#L98
Will try again tomorrow