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]

Categories
Misc

TFLite model showing many bad detections, should detect the yellow box and the tape markers on the floor. Same detections no matter what video I test. Not sure where to look to solve this. Any help appreciated!

TFLite model showing many bad detections, should detect the yellow box and the tape markers on the floor. Same detections no matter what video I test. Not sure where to look to solve this. Any help appreciated! submitted by /u/kbennett1999
[visit reddit] [comments]
Categories
Misc

Discover the Latest in Machine Learning, Graphics, HPC, and IoT at AWS re:Invent

Split screen of a man and his avatar.NVIDIA created content for AWS re:Invent, helping developers learn more about applying the power of GPUs to reach their goals faster and more easily.Split screen of a man and his avatar.

See the latest innovations spanning from the cloud to the edge at AWS re:Invent. Plus, learn more about the NVIDIA NGC catalog—a comprehensive collection of GPU-optimized software.

Working closely together, NVIDIA and AWS developed a session and workshop focused on learning more about NVIDIA GPUs and providing hands-on training on NVIDIA Jetson modules.

Register now for the virtual AWS re:Invent. >>

More information 

How to Select the Right Amazon EC2 GPU Instance and Optimize Performance for Deep Learning

Session ID: CMP328-S

Get all the information you need to make an informed choice for which Amazon EC2 NVIDIA GPU instance to use and how to get the most out of it by using GPU-optimized software for your training and inference workloads.

This NVIDIA-sponsored session—delivered by Shashank Prasanna, an AI and ML evangelist at AWS—focuses on helping engineers, developers, and data scientists solve challenging problems with ML.

Building a people counter with anomaly detection using AWS IoT and ML

Session ID: IOT306 

Get started with AWS IoT Greengrass v2, NVIDIA DeepStream, and Amazon SageMaker Edge Manager with computer vision in this workshop. Learn how to make and deploy a video analytics pipeline and build a people counter and deploy it to an NVIDIA Jetson Nano edge device.

This workshop is being delivered by Ryan Vanderwerf, Partner Solutions Architect, and Yuxin Yang, AI/ML IoT Architect.

Virtual content

APN.TV Segment: Simplified AI Model Deployment with Triton Inference Server

Join this session to learn how to use NVIDIA Triton in your AI workflows and maximize the AI performance on your GPUs and CPUs.

NVIDIA Triton is an open source inference-serving software to deploy deep learning and ML models from any framework (TensorFlow, TensorRT, PyTorch, OpenVINO, ONNX Runtime, XGBoost, or custom) on GPU‑ or CPU‑based infrastructure. 

Shankar Chandrasekaran, Sr. Product Marketing Manager of NVIDIA, discusses model deployment challenges, how NVIDIA Triton simplifies deployment and maximizes performance of AI models, how to use NVIDIA Triton on AWS, and a customer use case.

APN.TV Segment: Build ML Solutions Faster with NVIDIA NGC Catalog on AWS Marketplace

In this session, Abhilash Somasamudramath, NVIDIA Product Manager of AI Software, will show how to use free GPU-optimized software available on the NGC catalog in AWS Marketplace to achieve your ML goals.

ML has transformed many industries as companies adopt AI to improve operational efficiencies, increase customer satisfaction, and gain a competitive edge. However, the process of training, optimizing, and running ML models to build AI-powered applications is complex and requires expertise. 

The NVIDIA NGC catalog provides GPU-optimized AI software including frameworks, pretrained models, and industry-specific software development keys (SDKs) that accelerate workflows. This software allows data engineers, data scientists, developers, and DevOps teams to focus on building and deploying their AI solutions faster. 

theCUBE interview with Ian Buck, GM and Vice President of Accelerated Computing at NVIDIA

Hear Ian Buck discuss the latest trends in ML and AI, how NVIDIA is partnering with AWS to deliver accelerated computing solutions, and how NVIDIA makes accessing AI solutions easier than ever.