Need Equivalent code in JAVA [closed]

asked 2018-11-22 04:13:57 -0500

Mishal077 gravatar image
    (numClasses, height, width) = output.shape[1:4]

# our output class ID map will be num_classes x height x width in
# size, so we take the argmax to find the class label with the
# largest probability for each and every (x, y)-coordinate in the
# image
classMap = np.argmax(output[0], axis=0)

# given the class ID map, we can map each of the class IDs to its
# corresponding color
mask = COLORS[classMap]

# resize the mask and class map such that its dimensions match the
# original size of the input image (we're not using the class map
# here for anything else but this is how you would resize it just in
# case you wanted to extract specific pixels/classes)
mask = cv2.resize(mask, (image.shape[1], image.shape[0]),
classMap = cv2.resize(classMap, (image.shape[1], image.shape[0]),

# perform a weighted combination of the input image with the mask to
# form an output visualization
output = ((0.4 * image) + (0.6 * mask)).astype("uint8")

This is the python script that I am using right now i need to convert this code to Android application so for that i need some help as major of np kind of function will not be available out there.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2018-11-24 01:40:50.831518



please be more specific, where exactly your problem is.

also, what is the context of it ? what is "classMap" ? what is "output" ?

berak gravatar imageberak ( 2018-11-22 04:16:06 -0500 )edit

is this some segmentation dnn code ?

if so, you probably need some radical different approach, than what is done in python

berak gravatar imageberak ( 2018-11-22 05:26:26 -0500 )edit

Yup, it segmentation code in python. Can you suggest any approach how i can get this done on android. Working hard on this but not able to find equivalent options.

Mishal077 gravatar imageMishal077 ( 2018-11-23 02:15:48 -0500 )edit

question answered here , so i'll close this.

berak gravatar imageberak ( 2018-11-24 01:40:39 -0500 )edit