still learning Tensorflow and I'm trying to change a loss function in some code in Darkflow
The network outputs a given tensor with shape [49,3,2]. I would like to take the two elements in the last part of the tensor and process them with some code. I would then like to return the data back. So a bit like a map that would work with Tensorflow.
More Context - https://github.com/thtrieu/darkflow/blob/master/darkflow/net/yolo/train.py of the file I'm trying to change.
So not sure how to do this, please ask for more information If I've not been clear enough on the question. I still trying to get my head around what I want to do yet.
e.g
S = 7
SS = S * S
C = 8
B = 3
size1 = [None, SS, C]
size2 = [None, SS, B]
# Extract the coordinate prediction from net.out
coords = net_out[:, SS * (C + B):]
# Take flatten array and make it back into a tensor.
coords = tf.reshape(coords, [-1, SS, B, 4])
wh = tf.pow(coords[:,:,:,2:4], 2) * S # unit: grid cell
area_pred = wh[:,:,:,0] * wh[:,:,:,1] # unit: grid cell^2
centers = coords[:,:,:,0:2] # [batch, SS, B, 2]
floor = centers - (wh * .5) # [batch, SS, B, 2]
ceil = centers + (wh * .5) # [batch, SS, B, 2]
# calculate the intersection areas
# WHAT HAPPENS CURRENTLY
intersect_upleft = tf.maximum(floor, _upleft)
intersect_botright = tf.minimum(ceil , _botright)
intersect_wh = intersect_botright - intersect_upleft
intersect_wh = tf.maximum(intersect_wh, 0.0)
intersect = tf.multiply(intersect_wh[:,:,:,0], intersect_wh[:,:,:,1])
# I WANT TO CALCULATE THE AREA OF INTERSECTION THE BOX DIFFERENTLY SO
I WOULD HAVE
MY OWN FUNCTION DOING SOMETHING. BUT I ONLY WANT IT DONE FOR CENTERS
AND THEN RETURN A BIT LIKE A MAP FUNCTION BUT I NEED IT TO WORK WITH
TENSORFLOW PLACEHOLDERS
Any tips or advice would be good, thanks guy :D