deep-learning

Why do we want to scale outputs when using dropout?

余生长醉 提交于 2021-01-29 14:18:47
问题 From the dropout paper: "The idea is to use a single neural net at test time without dropout. The weights of this network are scaled-down versions of the trained weights. If a unit is retained with probability p during training, the outgoing weights of that unit are multiplied by p at test time as shown in Figure 2. This ensures that for any hidden unit the expected output (under the distribution used to drop units at training time) is the same as the actual output at test time." Why do we

Output score/probability for all class for each object with Tensorflow object detection API

亡梦爱人 提交于 2021-01-29 13:27:10
问题 in Tensorflow object detection API, we usually do this for each test image: output_dict = sess.run(tensor_dict, feed_dict={image_tensor: image_np_expanded}) # pdb.set_trace() # all outputs are float32 numpy arrays, so convert types as appropriate output_dict['num_detections'] = int(output_dict['num_detections'][0]) output_dict['detection_classes'] = output_dict['detection_classes'][0].astype(np.int64) output_dict['detection_boxes'] = output_dict['detection_boxes'][0] output_dict['detection

TensorFlow2-tf.keras: Loss and model weights suddenly become 'nan' when training MTCNN PNet

心已入冬 提交于 2021-01-29 12:59:14
问题 I was trying to use tfrecords to train the PNet of MTCNN. At first the loss was decreasing smoothly for the first few epochs and then it became 'nan' and so did the model weights. Below are my model structure and training results: def pnet_train1(train_with_landmark = False): X = Input(shape = (12, 12, 3), name = 'Pnet_input') M = Conv2D(10, 3, strides = 1, padding = 'valid', kernel_initializer = glorot_normal, kernel_regularizer = l2(0.00001), name = 'Pnet_conv1')(X) M = PReLU(shared_axes =

TensorFlow2-tf.keras: Loss and model weights suddenly become 'nan' when training MTCNN PNet

安稳与你 提交于 2021-01-29 12:21:01
问题 I was trying to use tfrecords to train the PNet of MTCNN. At first the loss was decreasing smoothly for the first few epochs and then it became 'nan' and so did the model weights. Below are my model structure and training results: def pnet_train1(train_with_landmark = False): X = Input(shape = (12, 12, 3), name = 'Pnet_input') M = Conv2D(10, 3, strides = 1, padding = 'valid', kernel_initializer = glorot_normal, kernel_regularizer = l2(0.00001), name = 'Pnet_conv1')(X) M = PReLU(shared_axes =

Detect facial landmarks inside a detected face image using opencv dnn face detector

丶灬走出姿态 提交于 2021-01-29 11:12:42
问题 I trying to detect the 68 facial landmarks of human face. I detected the face using OpenCV dnn face detector as in https://www.pyimagesearch.com/2018/02/26/face-detection-with-opencv-and-deep-learning/ The face detection process done successfully, this is my code: # import the necessary packages import numpy as np import argparse import cv2 import dlib ap = argparse.ArgumentParser() ap.add_argument("-c", "--confidence", type=float, default=0.5, help="minimum probability to filter weak

How to use many-to-one LSTM with variable-length input on Keras?

て烟熏妆下的殇ゞ 提交于 2021-01-29 09:33:58
问题 I have a multi-class sequence labeling problem where the number of time steps varies within samples. To use LSTM with variable-length input, I applied zero padding and masking to my input. I've read here that propagation of the mask stops after using LSTM layer with return_sequence=False parameter, that part confused me. My question is, would it be okay to use LSTM with return_sequence=False to calculate loss correctly for the below architecture ? from tensorflow.keras.layers import LSTM,

Merging Two Trained Networks for Inferencing Sequentially

ε祈祈猫儿з 提交于 2021-01-29 09:21:37
问题 I am trying to merge two trained neural networks. I have two trained Keras model files A and B. Model A is for image super-resolution and model B is for image colorization. I am trying to merge two trained networks so that I can inference SR+colorization faster. (I am not willing to use a single network to accomplish both SR and colorization tasks. I need to use two different networks for SR and colorization tasks.) Any tips on how to merge two Keras neural networks? 回答1: As long a the shape

Detect object by name of card and crop it using openCV

孤街醉人 提交于 2021-01-29 08:41:21
问题 I have a image with ID card, Bank card and signature i want to get id_card.jpg and bank_card.jpg and signature.jpg . The problem ID card and Bank card has the same width and height, i don't know how to detect each other. But the color is different suggestion possible get by color or the best idea is to get name of each card and after crop each card by name ?? I'm so new in this domain and i work in emergency project that why i will very grateful if someone can help me. The image look like

How to zero pad on both sides and encode the sequence into one hot in keras?

别说谁变了你拦得住时间么 提交于 2021-01-29 08:18:17
问题 I have text data as follows. X_train_orignal= np.array(['OC(=O)C1=C(Cl)C=CC=C1Cl', 'OC(=O)C1=C(Cl)C=C(Cl)C=C1Cl', 'OC(=O)C1=CC=CC(=C1Cl)Cl', 'OC(=O)C1=CC(=CC=C1Cl)Cl', 'OC1=C(C=C(C=C1)[N+]([O-])=O)[N+]([O-])=O']) As it is evident that different sequences have different length. How can I zero pad the sequence on both sides of the sequence to some maximum length. And then convert each sequence into one hot encoding based on each characters? Try: I used the following keras API but it doesn't

Normalizing images passed to torch.transforms.Compose function

老子叫甜甜 提交于 2021-01-29 07:21:53
问题 How to find the values to pass to the transforms.Normalize function in PyTorch? Also, where in my code, should I exactly do the transforms.Normalize? Since normalizing the dataset is a pretty well-known task, I was hoping there should be some sort of script for doing that automatically. At least I couldn't find it in PyTorch forum. transformed_dataset = MothLandmarksDataset(csv_file='moth_gt.csv', root_dir='.', transform=transforms.Compose([ Rescale(256), RandomCrop(224), transforms.Normalize