neural-network

Backpropagation in an Tensorflow.js Neural Network

天涯浪子 提交于 2020-12-12 15:33:05
问题 When I have been attempting to implement this function tf.train.stg(learningRate).minimize(loss) into my code in order to conduct back-propagation. I have been getting multiple errors such The f passed in variableGrads(f) must be a function . How would I implement the function above into the code bellow successfully? and Why does this error even occur? Neural Network: var X = tf.tensor([[1,2,3], [4,5,6], [7,8,9], [10,11,12]]) var Y = tf.tensor([[0,0,0],[0,0,0], [1,1,1]]) var m = X.shape[0]

What is the best way to build a model of automated system with neural network in Simulink (Matlab)?

倾然丶 夕夏残阳落幕 提交于 2020-12-12 12:18:10
问题 I'm tring to build a model contating neural network in Simulink. My idea is to compose a model which includes a controlled object (electrical drive), PID controller and NN block for fine-tuning of the PID controller. NN training is provided for to be the reinforcement learning. NN calculates the koefficients of the PID controller, then it receives the feedback from the output of the object and calcucales the koefficients for the next cycle to minimize the static error. I've build the model

How to write on video with cv2 AND MTCNN? I'm facing problems with fourcc

安稳与你 提交于 2020-12-12 04:48:08
问题 I'm trying to write a script that anonymized faces on videos. here is my code (python): import cv2 from mtcnn.mtcnn import MTCNN ksize = (101, 101) def decode_fourcc(cc): return "".join([chr((int(cc) >> 8 * i) & 0xFF) for i in range(4)]) def find_face_MTCNN(color, result_list): for result in result_list: x, y, w, h = result['box'] roi = color[y:y+h, x:x+w] cv2.rectangle(color, (x, y), (x+w, y+h), (0, 155, 255), 5) detectedFace = cv2.GaussianBlur(roi, ksize, 0) color[y:y+h, x:x+w] =

How to write on video with cv2 AND MTCNN? I'm facing problems with fourcc

*爱你&永不变心* 提交于 2020-12-12 04:47:21
问题 I'm trying to write a script that anonymized faces on videos. here is my code (python): import cv2 from mtcnn.mtcnn import MTCNN ksize = (101, 101) def decode_fourcc(cc): return "".join([chr((int(cc) >> 8 * i) & 0xFF) for i in range(4)]) def find_face_MTCNN(color, result_list): for result in result_list: x, y, w, h = result['box'] roi = color[y:y+h, x:x+w] cv2.rectangle(color, (x, y), (x+w, y+h), (0, 155, 255), 5) detectedFace = cv2.GaussianBlur(roi, ksize, 0) color[y:y+h, x:x+w] =

ImportError: cannot import name 'dnn_superres' for python example of super resolution with opencv

我只是一个虾纸丫 提交于 2020-12-10 06:58:32
问题 I am trying to run an example for upscaling images from the following website: https://towardsdatascience.com/deep-learning-based-super-resolution-with-opencv-4fd736678066 This is the code I am using: import cv2 from cv2 import dnn_superres # Create an SR object sr = dnn_superres.DnnSuperResImpl_create() # Read image image = cv2.imread('butterfly.png') # Read the desired model path = "EDSR_x3.pb" sr.readModel(path) # Set the desired model and scale to get correct pre- and post-processing sr

Using MTCNN with a webcam via OpenCV

旧时模样 提交于 2020-12-10 05:26:18
问题 I wish to be able to use a webcam and utilize MTCNN as the primary facial detector. Just as one can use Haar Cascades, I want to use MTCNN to find faces on my webcam This video is about breaking MTCNN, but nonetheless provides insight into my goal: https://www.youtube.com/watch?v=OY70OIS8bxs Here is my code so far. It used to be so that the plot would show and I'd have to "X" it out but now it just doesn't work from mtcnn.mtcnn import MTCNN import cv2 as cv from matplotlib import pyplot from

WARNING:tensorflow:`write_grads` will be ignored in TensorFlow 2.0 for the `TensorBoard` Callback

白昼怎懂夜的黑 提交于 2020-12-10 00:19:08
问题 I am using the following lines of codes to visualise the gradients of an ANN model using tensorboard tensorboard_callback = tf.compat.v1.keras.callbacks.TensorBoard(log_dir='./Graph', histogram_freq=1, write_graph = True, write_grads =True, write_images = False) tensorboard_callback .set_model(model) %tensorboard --logdir ./Graph I received a warning message saying "WARNING:tensorflow: write_grads will be ignored in TensorFlow 2.0 for the TensorBoard Callback." I get the tensorboard output,

WARNING:tensorflow:`write_grads` will be ignored in TensorFlow 2.0 for the `TensorBoard` Callback

微笑、不失礼 提交于 2020-12-10 00:18:17
问题 I am using the following lines of codes to visualise the gradients of an ANN model using tensorboard tensorboard_callback = tf.compat.v1.keras.callbacks.TensorBoard(log_dir='./Graph', histogram_freq=1, write_graph = True, write_grads =True, write_images = False) tensorboard_callback .set_model(model) %tensorboard --logdir ./Graph I received a warning message saying "WARNING:tensorflow: write_grads will be ignored in TensorFlow 2.0 for the TensorBoard Callback." I get the tensorboard output,

DL4J linear regression

笑着哭i 提交于 2020-12-04 03:55:54
问题 I am new in neural networks. I am trying to implement and train simple neural network with DL4j. My function: y = x * 2 + 300 My vision My result Parameters: public final int seed = 12345; public final int iterations = 1; public final int nEpochs = 1; public final int batchSize = 1000; public final double learningRate = 0.01; public final Random rng = new Random(seed); public final int numInputs = 2; public final int numOutputs = 1; public final double maxX = 100;//xmax = 100; ymax=500.

How to compute the cosine_similarity in pytorch for all rows in a matrix with respect to all rows in another matrix

六月ゝ 毕业季﹏ 提交于 2020-12-01 09:40:07
问题 In pytorch, given that I have 2 matrixes how would I compute cosine similarity of all rows in each with all rows in the other. For example Given the input = matrix_1 = [a b] [c d] matrix_2 = [e f] [g h] I would like the output to be output = [cosine_sim([a b] [e f]) cosine_sim([a b] [g h])] [cosine_sim([c d] [e f]) cosine_sim([c d] [g h])] At the moment I am using torch.nn.functional.cosine_similarity(matrix_1, matrix_2) which returns the cosine of the row with only that corresponding row in