Home > Blockchain >  How to speed up processing of thresholding using Tensorflow or Pytorch?
How to speed up processing of thresholding using Tensorflow or Pytorch?

Time:12-07

I'm new to Python and in the learning phase of image processing. Since I need to deal with large datasets which is basically only on thresholding, TensorFlow or Pytorch may be more suitable through the usage of GPU. I couldn't find any examples related, anyone feel free to share me some ideas ?

Tried to look for TensorFlow or Pytorch related for thresholding but not really found it.

Expectation implemented thresholding API through TensorFLow or Pytorch to speed up image thresholding process.

CodePudding user response:

you need to understand you can implement ratios on devices for simple tasks or multiple ratios propagation but for calculation, you can use the Tensorflow and Keras models too. The convolution layer is what you are doing by multiple of the input image with smaller or sizes matrixes and added strides effects that can resizes and remarks images from 256 x 256 to 32 x 32 with significant colors and relative position. Anyway, using program logic or implementing ratios propagation is nothing false.

Sample: Model implementation with mixed of Keras layers and function propagations.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
: Model Initialize
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
model = tf.keras.models.Sequential([
    tf.keras.layers.InputLayer(input_shape=( 32, 32, 4 )),
    tf.keras.layers.Normalization(mean=3., variance=2.),
    tf.keras.layers.Normalization(mean=4., variance=6.),
    tf.keras.layers.Conv2D(32, (3, 3), activation='relu'),
    tf.keras.layers.MaxPooling2D((2, 2)),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Reshape((128, 225)),
    tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(96, return_sequences=True, return_state=False)),
    tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(96)),
    tf.keras.layers.Flatten(),
    tf.keras.layers.Dense(192, activation='relu'),
    tf.keras.layers.Dense(10),
])

Output: It easily to create image recognitions using the Tensorflow Keras model.

Sample

Sample: Implementing at receivers or remote devices can perform simple feedback tasks with quicker responses.

temp = np.asarray(temp) * np.asarray([ coefficient_0, coefficient_1, coefficient_2, coefficient_3, coefficient_4, coefficient_5, coefficient_6, coefficient_7, coefficient_8, coefficient_9 ])
temp = tf.nn.softmax(temp)
action = int(np.argmax(temp))   

Output: Sample the game play with randoms functions, see my video I added examples.

Sample

  • Related