Categories
Misc

Help with Tensorflow Lite

Is anyone here able to help me out make a tensorflow lite object detection model I can run on my pi? I have all of the training data collected and labeled just need help making the model.

I have tried a few things including the Tensorflow Lite Model Maker as well as doing it from scratch locally. Just need help making my model.

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

Categories
Misc

Noob Here! Can you answer something for me?

Afternoon!

I would like to create an app around community based image feedback. Is it possible to create a model around what the community rates your existing images & use it to tentatively give a new image a score before anyone votes on it? Can I also incorporate other factors in the image, such as distance between objects or color of items to further refine the model later on?

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

Categories
Misc

Different Outputs on Mac M1 and Windows

I am running a CNN code on jupyter notebook

Tensorflow is giving me a very good output on Windows, but on mac, the loss doesnt change at all.

Its literally the same code and i am trying to figure out why this is happening.

https://github.com/jeffheaton/t81_558_deep_learning/blob/master/install/tensorflow-install-mac-metal-jul-2021.ipynb

i followed this instruction for installing tensorflow on mac

Tensor Flow Version: 2.5.0 Keras Version: 2.5.0 Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:24:02) [Clang 11.1.0 ] Pandas 1.3.4 Scikit-Learn 1.0.1 GPU is available

These are my tensow flow details.

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

Categories
Misc

How to incorporate a "black box" layer into a model? (Quantum Computing)

I’m trying to create a neural network where given the pure initial state of a quantum circuit (2D-vector), it spits out 2 numbers that would be essentially fed into a quantum computer to get results out. Currently, I have the step where I send a query to the quantum computer as a layer in the model. The quantum computer then will (in this case) spit out two numbers which I’d compare to the theoretical values.

As I was trying to implement this using the functional API, my custom layer was yelling at my because it did not like me using tf.unstack when it tried to build it by passing through a variable tensor. While this would probably be somewhat simple to fix, I ‘m concerned about how Qiskit would react to the values from the variable tensor or if it would work at all. Are there any workarounds or already implemented functions to achieve this?

Code:

Data Generation:

# TODO extend to complex amplitudes def generate_Hadamard_data(num_data): data = [] for _ in range(num_data): data_elem = preprocessing.normalize(np.random.rand(1, 2)).tolist()[0] data.append(data_elem) inv_sq2 = 1/np.sqrt(2) hadamard = np.array([[inv_sq2, inv_sq2], [inv_sq2, -1*inv_sq2]]) output = [np.matmul(hadamard, state).tolist() for state in data] data_ten = tf.constant(np.array(data).T, dtype=tf.float32) output_ten = tf.constant(np.array(output).T, dtype=tf.float32) print(output_ten) return tf.data.Dataset.from_tensor_slices(data_ten), tf.data.Dataset.from_tensor_slices(output_ten) 

Custom Layer:

class HadamardCircuitLayer(tf.keras.layers.Layer): ''' Takes in the initial data (state) and output (pulse params) from the neural network and runs it on the backend ibmq_armonk ''' def __init__(self, initial_data, shots=1024): super(HadamardCircuitLayer, self).__init__() # Unpack data data_iterator = initial_data.as_numpy_iterator() self.zero_coeffs = data_iterator.next() self.one_coeffs = data_iterator.next() self.shots = shots def build(self, shape): pass def call(self, output): custom_gate = Gate('custom_gate', 1, []) provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main') backend = provider.get_backend('ibmq_armonk') post_q_list = [] for a, b, pulse_params in zip(self.zero_coeffs, self.one_coeffs, tf.unstack(output)): norm = np.sqrt(a**2 + b**2) qc = QuantumCircuit(1, 1) qc.initialize([a/norm, b/norm], 0) qc.append(custom_gate, [0]) qc.measure(0, 0) pul = pulse_params.numpy() with pulse.build(backend, name='custom') as my_schedule: pulse.play(Gaussian(duration=64, amp=pul[0], sigma=np.e**pul[1]), pulse.drive_channel(0)) qc.add_calibration(custom_gate, [0], my_schedule) qc = transpile(qc, backend) job = execute(qc, backend=backend, shots=self.shots) counts = job.result().get_counts() post_q_list.append(np.array([counts["0"]/self.shots, counts["1"]/self.shots])) output_qten = tf.constant(post_q_list, dtype=tf.float32) print(output_qten) return output_qten 

Implementation:

# I haven't gotten far since running into the unstack error x_train, y_train = generate_Hadamard_data(1) dataset = tf.data.Dataset.zip((x_train, y_train)) inputs = tf.keras.Input(shape=(2,)) x = tf.keras.layers.Dense(128, activation="linear")(inputs) x = tf.keras.layers.Dropout(0.2)(x) x = tf.keras.layers.Dense(128, activation="linear")(x) x = tf.keras.layers.Dense(2, activation="linear")(x) outputs = HadamardCircuitLayer(x_train)(x) model = tf.keras.Model(inputs=inputs, outputs=outputs, name="microwave_pulse_model") 

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

Categories
Misc

Detecting blinks and Eye direction for switch input for disabilities – help needed! We have a model in python that needs migrating into the node app. Currently detecting blinks using mediapipe. Helping locked in patients speak.

Detecting blinks and Eye direction for switch input for disabilities - help needed! We have a model in python that needs migrating into the node app. Currently detecting blinks using mediapipe. Helping locked in patients speak. submitted by /u/squarepushercheese
[visit reddit] [comments]
Categories
Misc

How to learn tensorflow as a noob?

I am a mobile app developer. I have been working in IT for past 5 years. I took a Udemy course on TensforFlow from Zero to mastery. I thought as I have decent knowledge of software development I might pick up TensorFlow pretty quickly without really knowing the basics of machine learning but I was so wrong as I am having tough time understanding Tensorflow from the course. Everyone keep saying learn linear algebra, pandas, keras , scikit learn etc and a bunch of stuff. This is too much for me. For now I just want to learn how to create an ML model with a given data(Data can be anything image, text etc) and use that model in my web and mobile apps. I know there is something call TensorFlow lite which I can use in my apps directly but what is the bare minimum requirement I need to know before I start learning TensorFlow so I can easily pick it up later.

Also the the Udemy course which I took seems to be pretty good and lot of people seems to be liking it so I don’t think it really is the instructor’s fault as I don’t have my basics clear.

If anyone has any udemy courses that they can point me to would be great. I am looking more on practical approach and not jus theory boring stuff

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

Categories
Misc

A Very Thankful GFN Thursday: New Games, GeForce NOW Gift Cards and More

Happy Thanksgiving, members. It’s a very special GFN Thursday. As the official kickoff to what’s sure to be a busy holiday season for our members around the globe, this week’s GFN Thursday brings a few reminders of the joys of PC gaming in the cloud. Plus, kick back for the holiday with four new games Read article >

The post A Very Thankful GFN Thursday: New Games, GeForce NOW Gift Cards and More appeared first on The Official NVIDIA Blog.

Categories
Misc

How fast is tensorflow?

Hello everybody!

First of all, I know nothing about tensorflow YET. But I’m curious about the image classification / recognition feature and I want to learn it. But I have some questions regarding it.

Lets say, I have 1000 pics about differenct car parts / products (also 1000 parts)and they are fix,static, they never change. Tensorflow should recognize 1 product from those 1000. How fast will tensorflow give an output? How does the speed change if I would have like 10.000, or, just 100 products? Is this actually good use case for tensorflow? + How accurate will be the output?

Thanks for the answer in advance!

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

Categories
Misc

Beginning Machine Learning with TensorFlow JS Course Sale

Beginning Machine Learning with TensorFlow JS Course Sale submitted by /u/mwarr5225
[visit reddit] [comments]
Categories
Misc

TFlite model maker vs Tensorflow object detection api for edge inference

I have used Tensorflow object detection API ( https://github.com/tensorflow/models/tree/master/research/object_detection ) when I needed to do transfer learning of object detection models in the past 2 years. In most cases, I have used the trained models both in Tensorflow during development ( full version not TFLite ) on desktop as well as in TFLite after converting them to run on edge.

Some of the edge applications require a high FPS and therefore need to accelerate the inference using a Coral edge TPU. A constant issue with this approach has been that most model architectures in the Tensorflow object detection zoo are not possible to quantize and use with the Coral TPU. Some SSD models even fail or throw an Exception when trying to convert them to TFLite without quantization, although the documentation states that SSD models are supported.

I saw that the Tensorflow Lite Model maker ( https://www.tensorflow.org/lite/tutorials/model_maker_object_detection ) nowadays has support for transfer learning of EfficientDet models, including quantization and compilation for Coral. TFLite model maker also supports saving to “saved model” format. If I am not mistaken, It should then be possible to save the trained model both as .tflite for use in TFLite with Coral on edge and as saved_model for use with Tensorflow on desktop during development.

Does anyone have experience to share from working with Tensorflow lite model maker for object detection and then deployment on edge with Coral TPU? It would be valuable to hear what works well and what surprises / bugs to expect.

Thanks!

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