Categories
Misc

Serialize a model in a file

Hello, i am using tensorflow-addons API for a machine translation project.

I want to load my models and do predictions without train again them.

My architecture is Encoder – Decoder with Bahdanau Attention mechanism.

When i try to serialize the encoder and decoder objects in a file and i get this error :

TypeError: can’t pickle tensorflow.python.client._pywrap_tf_session.TF_Operation objects

How can i resolve this ?

submitted by /u/mdsoft6
[visit reddit] [comments]

Categories
Misc

Upcoming Webinar: Edge AI and Robotics Solutions with NVIDIA

Image of NVIDIA computer chip and Jetson Orin.Sign up for this AUVSI webinar on June 15 highlighting NVIDIA Jetson AGX Orin and the latest simulation technologies.Image of NVIDIA computer chip and Jetson Orin.

Categories
Misc

I’m trying to build a custom model for raspberry Pi using Google colab, but I’m stuck at an error which reads " The size of the train_data cannot be smaller than batch_size". I’ve tried varying the quantity of train/validate data, but all my attempts proved futile. Please help me out

submitted by /u/Bruce_Wayne_69_420
[visit reddit] [comments]

Categories
Misc

Powered Up: 5G and VR Accelerate Vehicle Battery Design

Traveling the scenic route between Wantage, a small town in Oxfordshire, and Coventry in the U.K. meanders up steep hills, past the birthplace of Shakespeare and skirts around 19th-century English bathhouses. A project using edge computing and the world’s first 5G-enabled VR technology is enabling two engineering teams in those locales, about 70 miles apart, Read article >

The post Powered Up: 5G and VR Accelerate Vehicle Battery Design appeared first on NVIDIA Blog.

Categories
Misc

Metric drops to 0 while fitting and stay there

Metric drops to 0 while fitting and stay there

Hey everyone, this has happened to me a couple of times now and I dont realize why.

Throughout fitting a pretrained model from huggingface (but also happened on own models) the metric (not only my custom metric, but also accuracy etc.) suddenly drop to 0 at a random epoch (sometimes 3rd, sometimes 4th, sometimes another..) and doesnt return.
Why could this be, do you have any ideas how to avoid this? train / test and overall hyperparameters work on other pretrained model without failure.

https://preview.redd.it/zm0cyhpb18591.png?width=1465&format=png&auto=webp&s=2ac1259ad6358f54eb7121f333201d351da6cc60

submitted by /u/hardwareDE
[visit reddit] [comments]

Categories
Misc

Changeable input size?

Can I make a model that takes different number of inputs. The output becomes more accurate as inputs increase. So more the inputs more the accurate output will be. But I kinda want it to slide between accuracy. Like if i give 5 inputs a less accurate output will be, if i want more accurate result I want to give more inputs. Can I do something like this?

submitted by /u/ash_hashtag
[visit reddit] [comments]

Categories
Misc

Optimizing TF.keras ML binary classifier for specific health task

Hello everyone, I am looking for advice on a specific task: optimizing the result of a binary classifier.

I have real-world DBs of health data from two centers regarding ER patients with a specific pathology and I am trying to see if i can distinguish between high grade/emergency cases and low grade/less urgent cases. It’s not an easy task, even for medical professionals. I have a number of parameters, both boolean (medical history, symptoms) and continuous (labs) that have been shown to be somewhat statistically relevant in distinguishing the two, as well as labels for each. Positivity is about 5% of the total, which is about 1000+200 cases. The data is incomplete, though, as not all clues are available for every patient. I am planning to use the larger DB for train/test/initial validation and the second, smaller DB as my real-world validation.

I set up a Sequential model using some online tutorials, though it is unclear to me what guides the choice of layer numbers/type/activation/etc. My current setup, after some fiddling, is the following (abridged, obviously):
epochs= 100
TEST_SIZE = 0.25
x_train, x_test, y_train, y_test = train_test_split( X, Y, test_size=TEST_SIZE)
# define the model
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Dense(10, input_dim=x_train.shape[1], activation=’relu’, kernel_initializer=’he_normal’))
model.add(tf.keras.layers.Dense(1, activation=’sigmoid’))

# compile the keras model
model.compile(optimizer=’adam’,
loss=tf.keras.losses.BinaryCrossentropy(),
metrics=[tf.keras.metrics.RecallAtPrecision(0.95), tf.keras.metrics.Accuracy(), tf.keras.metrics.Recall(), tf.keras.metrics.Precision()])

# Fit model on training data
history = model.fit(x_train, y_train, validation_split=0.33, batch_size=16, epochs=EPOCHS)

Now, this is not a time sensitive operation, so I would like to get the best result possible. I would also like not to miss positive cases if I can help it, within reason. I suppose I could add in a “maybe” category if it increases accuracy significantly on the other two categories.
This is what I am at right now (it varies every run, sometimes significantly):

Original Set
RecallAtPrecision: 0.00
Accuracy: 0.24
recall – specificity: 60.00
precision – sensibility: 50.00

Validation
RecallAtPrecision: 8.00
Accuracy: 0.00
recall – specificity: 52.00
precision – sensibility: 76.47

Now, to the issues:

  1. Why accuracy is so low, while sensibility/specificity are not that bad?
  2. What can i do to make things better? More or less layers? More or less nodes? More epochs? Different setup altogether? Would it make sense to automate the search for the best parameters somehow?
  3. Any general advice on the matter? Any accessible resources that I could look up? (please note that I am a heath professional, not a software developer. I only learned python and a few rudiments of ML in the last few months to see if I can automate stuff like this).

Thank you in advance for your kind responses. I am counting on you to illuminate my way forward

submitted by /u/N0Br41nZ
[visit reddit] [comments]

Categories
Misc

How do I carry out a simple Federated K-Means implementation in Tensorflow?

I am trying to carry out K-Means algorithm in a federated environment using the in-built algorithm function provided by TFF.

I am passing a list of

<PrefetchDataset element_spec=OrderedDict( [('x', TensorSpec(shape=(7811, 3), dtype=tf.float64, name=None))] )> 

of a couple of clients in the 2nd argument of next function for tff.learning.algorithms.build_fed_kmeans

The build_fed_kmeans function has been called like so:

iterative_process = tff.learning.algorithms.build_fed_kmeans( 10, data_shape = (7811,3), random_seed = (2,5) ) 

Error

TypeNotAssignableError: Type `<x=float64[7811,3]>*` is not assignable to type `float32[7811,3]*` 

How can I go correcting this error?

submitted by /u/ChaosAdm
[visit reddit] [comments]

Categories
Misc

loading dataset from minIO S3 bucket for training.

I am trying to load TFRecords dataset from minIO S3 bucket and read them and use them for training on the go as done in this link: https://www.google.com/amp/s/blog.min.io/hyper-scale-machine-learning-with-minio-and-tensorflow/amp/

But when I do model.fit(), It gives following error: next(iter(training_mapped_ds)).

Traceback (most recent call last): File “/home/vishal/miniotf2.py”, line 281, in <module> batch =next(iter(mapped_ds)) File “/home/vishal/anaconda3/lib/python3.9/site-packages/tensorflow/python/data/ops/iterator_ops.py”, line 766, in __next_ return self._next_internal() File “/home/vishal/anaconda3/lib/python3.9/site-packages/tensorflow/python/data/ops/iterator_ops.py”, line 749, in _next_internal ret = gen_dataset_ops.iterator_get_next( File “/home/vishal/anaconda3/lib/python3.9/site-packages/tensorflow/python/ops/gen_dataset_ops.py”, line 3017, in iterator_get_next _ops.raise_from_not_ok_status(e, name) File “/home/vishal/anaconda3/lib/python3.9/site-packages/tensorflow/python/framework/ops.py”, line 7164, in raise_from_not_ok_status raise core._status_to_exception(e) from None # pylint: disable=protected-access tensorflow.python.framework.errors_impl.UnknownError: : curlCode: 35, SSL connect error [Op:IteratorGetNext]

submitted by /u/randomName123s
[visit reddit] [comments]

Categories
Misc

is there a way to code a QR detection library from scratch?

recently became obsessed with QR codes in shapes other than square, but all of the documentation out there only explain how to code QR code scanners using libraries (Pyzbar for example) rather than coding the thing from scratch. Now, given that I’m not particularly interested in square QR codes, one would think that coding and creating my own QR codes is the thing to do here. My information, howsoever, are hardly sufficient for me to say anything for sure, or if this whole thing is even possible. (because if it is, why is the hexagon QR code for example still not a thing??)

I guess what I’m trying to say is I would appreciate any information you guys would have on said topic ^-^

DANKE IM VORAUS!

submitted by /u/Fadi_Soltan
[visit reddit] [comments]