tensorflow

How to read (decode) .tfrecords file, see the images inside and do augmentation?

孤人 提交于 2021-01-29 02:40:22
问题 I have a .tfrecords file and I want to extract, see the images in the file and augment them. I am using https://colab.research.google.com TensorFlow version: 2.3.0 And for the following code raw_dataset = tf.data.TFRecordDataset("*path.tfrecords") for raw_record in raw_dataset.take(1): example = tf.train.Example() example.ParseFromString(raw_record.numpy()) print(example) I am facing the following output: features { feature { key: "depth" value { int64_list { value: 3 } } } feature { key:

ValueError: Operation 'cond_25/Shape' has been marked as not fetchable

北城以北 提交于 2021-01-29 02:22:59
问题 The above error occurs when I try to do the following: se = tf.Session() cont = tf.constant([[1., 2., 4., 5.], [5., 2., 7., 8.]]) def f1(): print(se.run(tf.shape(cont))) return True def f2(): return False r = tf.cond(tf.greater(tf.constant(10), tf.constant(9)), f1, f2) The complete error log is as follows: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "

Use tf functions instead of for loops tensorflow to get slice/mask

左心房为你撑大大i 提交于 2021-01-29 02:02:50
问题 I have 2 tensors, my prediction tensor pred is of shape [batch, rows, cols, depth, vals] or [32, 40, 60, 2, 2] . My ground truth tensor y is shape [batch, num_objs, vals] or [32, 4, 10] . The y tensor has values that correspond to a slice of the pred tensor. I get the indexes using true_grid_coords = (y[:,:,:2] // params.grid_stride) Now I want to create a mask with the same shape as my pred tensor using the vals from true_grid_coords . I want something like [batch, rows, cols, depth, vals] =

Use tf functions instead of for loops tensorflow to get slice/mask

此生再无相见时 提交于 2021-01-29 01:57:59
问题 I have 2 tensors, my prediction tensor pred is of shape [batch, rows, cols, depth, vals] or [32, 40, 60, 2, 2] . My ground truth tensor y is shape [batch, num_objs, vals] or [32, 4, 10] . The y tensor has values that correspond to a slice of the pred tensor. I get the indexes using true_grid_coords = (y[:,:,:2] // params.grid_stride) Now I want to create a mask with the same shape as my pred tensor using the vals from true_grid_coords . I want something like [batch, rows, cols, depth, vals] =

Determine whether a model is pytorch model or a tensorflow model or scikit model

▼魔方 西西 提交于 2021-01-29 00:39:41
问题 If I want to determine the type of model i.e. from which framework was it made programmatically, is there a way to do that? I have a model in some serialized manner(Eg. a pickle file). For simplicity purposes, assume that my model can be either tensorflow's, pytorch's or scikit learn's. How can I determine programmatically which one of these 3 is the one? 回答1: AFAIK, I have never heard of Tensorflow/Keras and Pytorch models to be saved with pickle or joblib - these frameworks provide their

Determine whether a model is pytorch model or a tensorflow model or scikit model

二次信任 提交于 2021-01-29 00:36:15
问题 If I want to determine the type of model i.e. from which framework was it made programmatically, is there a way to do that? I have a model in some serialized manner(Eg. a pickle file). For simplicity purposes, assume that my model can be either tensorflow's, pytorch's or scikit learn's. How can I determine programmatically which one of these 3 is the one? 回答1: AFAIK, I have never heard of Tensorflow/Keras and Pytorch models to be saved with pickle or joblib - these frameworks provide their

Saving a 'fine-tuned' bert model

时光怂恿深爱的人放手 提交于 2021-01-29 00:24:54
问题 I am trying to save a fine tuned bert model. I have ran the code correctly - it works fine, and in the ipython console I am able to call getPrediction and have it result the result. I have my weight files saved (highest being model.ckpt-333.data-00000-of-00001 I have no idea how I would go about saving the model to be reuseable. I am using bert-tensorflow. import json import pandas as pd import tensorflow as tf import tensorflow_hub as hub from datetime import datetime from sklearn.model

Saving a 'fine-tuned' bert model

青春壹個敷衍的年華 提交于 2021-01-29 00:21:49
问题 I am trying to save a fine tuned bert model. I have ran the code correctly - it works fine, and in the ipython console I am able to call getPrediction and have it result the result. I have my weight files saved (highest being model.ckpt-333.data-00000-of-00001 I have no idea how I would go about saving the model to be reuseable. I am using bert-tensorflow. import json import pandas as pd import tensorflow as tf import tensorflow_hub as hub from datetime import datetime from sklearn.model

Saving a 'fine-tuned' bert model

白昼怎懂夜的黑 提交于 2021-01-29 00:16:44
问题 I am trying to save a fine tuned bert model. I have ran the code correctly - it works fine, and in the ipython console I am able to call getPrediction and have it result the result. I have my weight files saved (highest being model.ckpt-333.data-00000-of-00001 I have no idea how I would go about saving the model to be reuseable. I am using bert-tensorflow. import json import pandas as pd import tensorflow as tf import tensorflow_hub as hub from datetime import datetime from sklearn.model

Alternative function for tf.contrib.layers.flatten(x) Tensor Flow

家住魔仙堡 提交于 2021-01-29 00:12:50
问题 i am using Tensor flow 0.8.0 verison on Jetson TK1 with Cuda 6.5 on 32 bit arm architecture. For that i can't upgrade the Tensor Flow version and i am facing trouble in Flatten function x = tf.placeholder(dtype = tf.float32, shape = [None, 28, 28]) y = tf.placeholder(dtype = tf.int32, shape = [None]) images_flat = tf.contrib.layers.flatten(x) The error i am getting at this point is AttributeError: 'module' object has no attribute 'flatten' is there any alternative to this function that may be