Categories
Misc

Cannot read property ‘children’ of undefined with using Tensorflow Object Detection API model in tfjs

System information – Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): Yes – OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 – Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A – TensorFlow.js installed from (npm or script link): npm install @tensorflow/tfjs – TensorFlow.js version (use command below): 3.6.0 – Browser version: Chrome 90 on Windows 10 – Tensorflow.js Converter Version: 3.6.0

Hyperlinks are capitalized to prevent confusion(because the color settings(and blue filter) on my monitor make it hard to see the difference between them)

Describe the current behavior I used transfer learning using a pretrained model from the Tensorflow Object Detection API, which i converted to tensorflow-js using the tensorflow-converter API in python. View the ipynb notebook HERE. I then followed @hugozanini’s REPO which had a template for using your tensorflow object detection models in javascript; I copied the index.json file and put it into a sandbox, replacing his model.json file with mine. The repo which contains it can be found here

Describe the expected behavior I was expecting the model to work and the program to run normally, like it did in this DEMO. Instead, I got

index.js:1437 TypeError: Cannot read property ‘children’ of undefined at operation_mapper.js:409 at Array.forEach (<anonymous>) at operation_mapper.js:403 at Array.forEach (<anonymous>) at OperationMapper.mapFunction (operation_mapper.js:401) at operation_mapper.js:163 at Array.reduce (<anonymous>) at OperationMapper.transformGraph (operation_mapper.js:162) at GraphModel.loadSync (graph_model.js:159) at GraphModel._callee$ (graph_model.js:119) at tryCatch (runtime.js:62) at Generator.invoke [as _invoke] (runtime.js:288) at Generator.prototype.<computed> [as next] (runtime.js:114) at asyncGeneratorStep (asyncToGenerator.js:3) at _next (asyncToGenerator.js:25)

Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/CodePen/any notebook.

HERE is the colab notebook I used to train my model HERE is the sandbox where I tried to use the tensorflow.js model

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

Error Message:

index.js:1437 TypeError: Cannot read property ‘children’ of undefined at operation_mapper.js:409 at Array.forEach (<anonymous>) at operation_mapper.js:403 at Array.forEach (<anonymous>) at OperationMapper.mapFunction (operation_mapper.js:401) at operation_mapper.js:163 at Array.reduce (<anonymous>) at OperationMapper.transformGraph (operation_mapper.js:162) at GraphModel.loadSync (graph_model.js:159) at GraphModel._callee$ (graph_model.js:119) at tryCatch (runtime.js:62) at Generator.invoke [as _invoke] (runtime.js:288) at Generator.prototype.<computed> [as next] (runtime.js:114) at asyncGeneratorStep (asyncToGenerator.js:3) at _next (asyncToGenerator.js:25)

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

Categories
Misc

Making art from science using AI in TensorFlow.js

Making art from science using AI in TensorFlow.js submitted by /u/mwarr5225
[visit reddit] [comments]
Categories
Misc

Researchers Harness GANs for Super-Resolution of Space Simulations

Carnegie Mellon University and University of California researchers developed a deep learning model that upgrades cosmological simulations from low to high resolution, allowing scientists to create a complex simulated universe within a day.

Astrophysics researchers have long faced a tradeoff when simulating space— simulations could be either high-resolution or cover a large swath of the universe. With the help of generative adversarial networks, they can accomplish both at once.

Carnegie Mellon University and University of California researchers developed a deep learning model that upgrades cosmological simulations from low to high resolution, allowing scientists to create a complex simulated universe within a day. 

These simulations are critical for researchers to unravel mysteries around galaxy formation, dark matter and dark energy. 

“Cosmological simulations need to cover a large volume for cosmological studies, while also requiring high resolution to resolve the small-scale galaxy formation physics, which would incur daunting computational challenges. said Yueying Ni, a Ph.D. candidate at Carnegie Mellon. “Our technique can be used as a powerful and promising tool to match those two requirements simultaneously by modeling the small-scale galaxy formation physics in large cosmological volumes.”  

The team’s GAN model can take full-scale, low-resolution models and turn them into super-resolution simulations with up to 512 times as many particles. Though it was trained on data from only small areas of space, the model was able to replicate large-scale structures seen only in massive simulations. 

Published in PNAS, the journal of the National Academy of Sciences, the project used the hundreds of NVIDIA RTX GPUs on the Texas Advanced Computing Center’s Frontera system.   

Using deep learning, the researchers could upscale the low-res model at the left to the super-res model at right — capturing the same detail as a conventional high-res model (center) while using much fewer computational resources. Image credit: Y. Li et al/PNAS 2021.

While existing methods would take over three weeks on a single processing core to create a detailed simulation of 134 million particles, the GPU-accelerated deep learning approach does it in just 36 minutes. And for simulations 1,000 times as large, the new method shrunk simulation time down from months on a dedicated supercomputer to 16 hours on a single GPU.

This acceleration can help scientists run more simulations to predict how the universe would look in different scenarios. 

“With our previous simulations, we showed that we could simulate the universe to discover new and interesting physics, but only at small or low-res scales,” said Rupert Croft, physics professor at Carnegie Mellon. “By incorporating machine learning, the technology is able to catch up with our ideas.”

Since the current neural networks focused on how gravity moves dark matter around over time, other phenomena such as supernovae and black holes were left out of the simulations. The team next plans to extend their methods to capture the forces responsible for these events. 

“The universe is the biggest data set there is,” said Scott Dodelson, head of the department of physics at Carnegie Mellon and director of the National Science Foundation Planning Institute for Artificial Intelligence in Physics. And “artificial intelligence is the key to understanding the universe and revealing new physics.” 

Read the full article in PNAS >> 

Read more >> 

Main image from TNG Simulations

Categories
Misc

Accelerating k-nearest Neighbors 600x Using RAPIDS cuML

k-Nearest Neighbors classification is a straightforward machine learning technique that predicts an unknown observation by using the k most similar known observations in the training dataset. In the second row of the example pictured above, we find the seven digits 3, 3, 3, 3, 3, 5, 5 from the training data are most similar to … Continued

This post was originally published on the RAPIDS AI Blog.

k-Nearest Neighbors classification is a straightforward machine learning technique that predicts an unknown observation by using the k most similar known observations in the training dataset. In the second row of the example pictured above, we find the seven digits 3, 3, 3, 3, 3, 5, 5 from the training data are most similar to the unknown digit. We then use a majority vote to predict that the unknown digit is a 3.

Distance computations

The k-nearest neighbor’s algorithm has no training time. All computation takes place during inference. To infer (predict) one unknown observation, we must compute how similar that unknown observation is to each of the known training observations. Mathematically, observation is just a vector therefore similarity is the distance between two vectors. Different distance formulas exist, but the most popular is Euclidean distance. Given two observations x_1 ∈ R^p and x_2 ∈ R^p, the formula is:

dist = √(x_1-x_2)∙(x_1-x_2)

Thus we see if we have p features, then it requires p multiplies, psubtractions, p additions, and one square root to compute the distance between two observations. Since we must compare all the test observations with all the training observations, the total number of computations ignoring square root is 3 * p * len(train) * len(test). The time difference between RAPIDS cuML and Scikit-learn will be the difference it takes to make these trillions of computations.

Speed test on Kaggle

Besides hosting competitions, datasets, discussions, and Jupyter notebooks; Kaggle offers free GPU cloud compute. Their GPU virtual machines have one Nvidia Tesla P100 GPU and one Intel Xeon 2-core CPU. Using the famous MNIST digit image dataset, we compare the difference it takes RAPIDS cuML’s kNN to predict all the unknown digits in Kaggle’s MNIST digit-recognizer competition compared with Scikit-learn’s kNN.At Kaggle, we can install RAPIDS with the following code. Change rapids=0.19 to the version you desire.

import sys
!cp ../input/rapids/rapids.0.19.0 /opt/conda/envs/rapids.tar.gz
!cd /opt/conda/envs/ && tar -xzvf rapids.tar.gz > /dev/null
sys.path = ["/opt/conda/envs/rapids/lib/python3.7/site-packages"] + sys.path
sys.path = ["/opt/conda/envs/rapids/lib/python3.7"] + sys.path
sys.path = ["/opt/conda/envs/rapids/lib"] + sys.path
!cp /opt/conda/envs/rapids/lib/libxgboost.so /opt/conda/lib/

Then we load the training and test data and predict using RAPIDS cuML:

# RAPIDS cuML kNN model
import cudf, cuml
from cuml.neighbors import KNeighborsClassifier as cuKNeighbors
train = cudf.read_csv(‘../input/digit-recognizer/train.csv’)
test = cudf.read_csv(‘../input/digit-recognizer/test.csv’)
model = cuKNeighbors(n_neighbors=7)
model.fit(train.iloc[:,1:785], train.iloc[:,0])
y_hat = model.predict(test)

The line of code model.predict(test) does all the work. It finishes in an incredibly fast 2.5 seconds on GPU. Next, we predict with Scikit-learn:

# Scikit-learn kNN model
import pandas
from sklearn.neighbors import KNeighborsClassifier as skKNeighbors
train = pandas.read_csv('../input/digit-recognizer/train.csv')
test = pandas.read_csv('../input/digit-recognizer/test.csv')
model = skKNeighbors(n_neighbors=7)
model.fit(train.iloc[:,1:785], train.iloc[:,0])
y_hat = model.predict(test)

On CPU with Scikit-learn, the function call model.predict(test) takes 25 minutes. We witness RAPIDS cuML performing 600 times faster!

On Kaggle, the training dataset has length 42,000 and the test dataset has length 28,000. The dimension p of the images is 784. Therefore to predict all test images, we must perform 2.8 trillion computations! (3 * 784 * 42000 * 28000 = 2.8e12). The Intel Xeon 2-core CPU has clock speed 2GHz and 2 cores, so we expect it to take approximately 690 seconds. (2.8e12 / 2e9 / 2 = 690). The Nvidia Tesla P100 has clock speed 1GHz and 3500 CUDA cores, so we expect it to take 0.80 seconds. (2.8e12 / 1e9 / 3500 = 0.80). Therefore we expected approximately a 600x speedup.

Do more in less time

Since RAPIDS cuML is so fast, we now have an opportunity to explore improving our model’s accuracy by performing additional tasks. Below are some ideas:

  • Hyperparameter Search
  • Feature Engineering and Selection
  • Data Augmentation
  • Ensemble with Bagging and Boosting

We will not explore feature engineering and selection in this blog nor bagging and boosting, but we will explore hyperparameter search and data augmentation below.

Hyperparameter search

The following code demonstrates a cross-validation hyperparameter search. If we did this with Scikit-learn’s kNN, it would literally take a few days! But with RAPIDS cuML kNN, it only takes a few minutes! Also, note how easy it is to mix RAPIDS cuML with Scikit-learn’s KFold.

 from sklearn.model_selection import KFold
 for k in range(3,22,2):
 oof = np.zeros(len(train))
 skf = KFold(n_splits=5, shuffle=True, random_state=42)
 for i,(idxT, idxV) in
    enumerate(skf.split(train.iloc[:,1:],train.label)):
    model= cuKNeighbors(n_neighbors=k)
    model.fit(train.iloc[idxT,1:], train.label[idxT])
    y_hat = model.predict(train.iloc[idxV,1:])
    oof[idxV] =  y_hat[0].to_array()
    acc = ( oof==train.label.to_array() ).sum()/len(train)
    print('k =',k,'has ACC =',acc) 

Validation shows us that the best kNN parameter for k is k=3. Using this parameter, we can predict all of Kaggle competition’s unknown test images and submit for an accuracy of 96.9%. That’s a great accuracy for 2.5 seconds of work!

The Kaggle notebook with full code to achieve 96.9% is here: https://www.kaggle.com/cdeotte/rapids-gpu-knn-mnist-0-97

Data augmentation

Another way to improve the accuracy of a model is to provide the model with more training data. Since a digit is still the same digit if you shift, rotate, or scale the image. We can create more training data by randomly shifting, rotating, and scaling the given training data. Kaggle provides 42,000 training images. Let’s create 2 million more training images. If we added this many new training images to Scikit-learn’s kNN model, it would cause the model to take days to predict the test images. With RAPIDS cuML, it will only add a minute of additional inference time!

 
 from keras.preprocessing.image import ImageDataGenerator
 datagen = ImageDataGenerator(rotation_range=10, zoom_range = 0.10,
    width_shift_range=0.1, height_shift_range=0.1)
 da = 50; bs=4200
 train2 = np.zeros((train.shape[0]*da,train.shape[1]),
    dtype=np.float32)
 for k,(X,Y) in enumerate( datagen.flow(
    train[:,1:].reshape((-1,28,28,1)),
    train[:,0].reshape((-1,1)) ,batch_size=bs ) ):
    train2[bs*k:bs*(k+1),1:] = X.reshape((-1,784))
    train2[bs*k:bs*(k+1),0] = Y.reshape((-1))
    if k==train2.shape[0]//bs-1: break 

Next, we build our RAPIDS cuML model with this new data.

model.fit(train2[:,1:785], train2[:,0])

y_hat = model.predict(test)

RAPIDS cuML executes the call model.predict(test) in an incredible 14.2 seconds. There are 2 million rows in train2, therefore model.predict(test) was able to compute 131.7 trillion multiplies, subtractions, and additions in 14.2 seconds. Absolutely incredible! (3 * 2e6 * 28000 * 784 = 131.7e12). By doing more in less time, RAPIDS cuML achieved a higher accuracy of 98.5%. Woohoo!

The Kaggle notebook with full code to achieve 98.5% accuracy is here: https://www.kaggle.com/cdeotte/rapids-data-augmentation-mnist-0-985

Categories
Misc

Putting in a Good Word: GPU-Powered Crossword Solver Makes Best Showing Yet Against Humans

What’s a three-letter acronym for a “video-handling chip”? A GPU, of course. Who knew, though, that these parallel processing powerhouses could have a way with words, too. Following a long string of victories for computers in other games — chess in 1997, go in 2016 and Texas hold’em poker in 2019 — a GPU-powered AI Read article >

The post Putting in a Good Word: GPU-Powered Crossword Solver Makes Best Showing Yet Against Humans appeared first on The Official NVIDIA Blog.

Categories
Misc

Advice for Newbie

This maybe treated as a spam because there was a lot question like that but anyway I will try 😉 ?

I was wondering what advice do you have for someone new, how would you start for example with image recognition to make the simplest app ?

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

Categories
Misc

Sharing weights between tf versions

Are there any limitations to sharing model weights when it’s between two different tensorflow versions? I’m not expecting this to be the case just wanted to check there isn’t something hidden I don’t know.

Ex. Learn a model on version A. Save weights.

Recreate the model in version B. Load the weights.

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

Categories
Misc

AI of Earthshaking Magnitude: DeepShake Predicts Quake Intensity

In a major earthquake, even a few seconds of advance warning can help people prepare — so Stanford University researchers have turned to deep learning to predict strong shaking and issue early alerts.

In a major earthquake, even a few seconds of advance warning can help people prepare — so Stanford University researchers have turned to deep learning to predict strong shaking and issue early alerts.

DeepShake, a spatiotemporal neural network trained on seismic recordings from around 30,000 earthquakes, analyzes seismic signals in real time. By observing the earliest detected waves from an earthquake, the neural network can predict ground shaking intensity and send alerts throughout the area. 

Geophysics and computer science researchers at Stanford used a university cluster of NVIDIA GPUs to develop the model, using data from the 2019 Ridgecrest sequence of earthquakes in Southern Califonia. 

When tested with seismic data from Ridgecrest’s 7.1 magnitude earthquake, DeepShake provided simulated alerts to nearby seismic stations 7 to 13 seconds before the arrival of high intensity ground shaking.

Most early warning systems pull multiple information sources, first determining the location and magnitude of an earthquake before calculating ground motion for a specific area. 

“Each of these steps can introduce error that can degrade the ground shaking forecast,” said Stanford student Daniel Wu, who presented the project at the 2021 Annual Meeting of the Seismological Society of America. 

Instead, the DeepShake network relies solely on seismic waveforms for its rapid early warning and forecasting system. The unsupervised neural network learned which features of seismic waveform data best forecast the strength of future shaking. 

“We’ve noticed from building other neural networks for use in seismology that they can learn all sorts of interesting things, and so they might not need the epicenter and magnitude of the earthquake to make a good forecast,” said Wu. “DeepShake is trained on a preselected network of seismic stations, so that the local characteristics of those stations become part of the training data.”

Given 15 seconds of measured ground shaking, the model can predict future shaking intensity at all seismic stations in its network — with no prior knowledge of station locations.  

The team plans to expand the neural network to cover a broader geographical region, and cover for the possibility of fail-cases including downed stations and high network latency. The group sees DeepShake as complementary to California’s ShakeAlert warning system, operated by the United States Geological Survey. 

Read more >>

Categories
Misc

Need for Speed: Researchers Switch on World’s Fastest AI Supercomputer

It will help piece together a 3D map of the universe, probe subatomic interactions for green energy sources and much more. Perlmutter, officially dedicated today at the National Energy Research Scientific Computing Center (NERSC), is a supercomputer that will deliver nearly four exaflops of AI performance for more than 7,000 researchers. That makes Perlmutter the Read article >

The post Need for Speed: Researchers Switch on World’s Fastest AI Supercomputer appeared first on The Official NVIDIA Blog.

Categories
Misc

NVIDIA BlueField European Hackathon Fuels Data Center Innovation with Pioneering DPU-based Applications Demonstrations

At NVIDIA where non-stop innovation is our culture, we are hosting a global series of regional Data Processing Unit (DPU) software hackathons over the next 12 months, aimed at advancing research and development in data center and AI technologies.

First in a global series of NVIDIA developer events, the DPU hackathons unleashes breakthrough technologies built on NVIDIA DOCA, furthering advancements in AI, cloud and accelerated computing

“The data center is the new unit of computing. Cloud computing and AI are driving fundamental changes in the architecture of data centers.” — NVIDIA founder and CEO Jensen Huang

At NVIDIA where non-stop innovation is our culture, we are hosting a global series of regional Data Processing Unit (DPU) software hackathons over the next 12 months, aimed at advancing research and development in data center and AI technologies.

The first digital DPU hackathon was held on May 24-25 for European developers and researchers from prominent ecosystem partners, customer organizations and academia. The successful European hackathon delivered a number of groundbreaking inventions in high-performance networking, virtualization, cybersecurity, storage, accelerated AI and edge computing, video processing and more. Standing out from the crowd was the team from MTS PJSC, Russia’s largest mobile operator and a leading provider of media and digital services, taking home the gold for their video CDN edge project.

The team created a DPU-accelerated edge computing platform that is optimized for secure video streaming. The platform is hosted on a single BlueField DPU card, running NGINX for web content delivery, and leverages hardware accelerators for TLS crypto acceleration. The platform can be further enhanced with video packet pacing technology, and an optimized TCP/IP software stack. The accomplished performance target set forth by the team was serving 10K transactions per second of 100KB video payload at 10Gb/s speed.

Fostering Data Center Innovation

NVIDIA hackathons draw on our core values: innovation, excellence, speed and agility. They assemble bright minds, enabling developers to learn, collaborate, and accelerate their work under the guidance of expert mentors by their side. 

The DPU hackathon series also draws on our pioneering BlueField data center-on-a-chip architecture (DOCA) technology foundation— serving as a testament to our commitment to building a broad developer community to create revolutionizing data center infrastructure applications and services, powered by NVIDIA BlueField DPUs and DOCA software framework.

With the release of the NVIDIA DOCA 1.0 at GTC 21, developers today have an easy way to program BlueField DPUs that leverages open APIs, libraries and reference code for various applications. 

“DOCA plays a central role in NVIDIA’s data center-on-a-chip vision, providing a unified and future-proof architecture for all BlueField DPU product generations,” said Dror Goldenberg, SVP of Software Technologies. “This global series of DPU hackathons will center around innovation based on DPU and DOCA, supporting our journey to build a thriving ecosystem of DPU-accelerated applications that will reshape the data center of the future.”

First Time’s a Charm: Recapping Europe’s DPU Hackathon

The first NVIDIA DPU hackathon event drew significant attention and excitement, with applications rocketing. Our steering committee selected 14 brilliant project teams from among 60 applicants and various industries: cloud service providers and web-scalers, telecom operators, independent software vendors, and academia.

The DPU hackathon took place over Zoom for 30 hours straight. Prior to that, NVIDIA hosted an online DPU bootcamp to empower the participating teams with requisite BlueField DPU knowledge and DOCA programming skills. Most of the hackathon time was dedicated to the teams’ collaboration and execution of their projects, with mentors providing support based on various domain expertise.

As a member of the hackathon judging panel, our role was to provide constructive feedback to project teams throughout the event. One of the main things we kept an eye out for was innovative technology for solving key data center challenges, accompanied by a proof-of-concept to support the team’s claims. Another evaluation criteria was how well the technology meets data center scale and performance requirements.

Finally, we were truly amazed by the teams’ work and results. Here’s a summary of the top inventions:

  • First place won by the MTS PJSC team from Russia showcased an innovative, DPU-accelerated solution for ultra-low power (ULP) CDN edge deployments.
  • Second place went to the Datadigest B.V. Nikhef team from the Netherlands for developing a DPU-based, scalable, AI-accelerated Intrusion detection and prevention system (IDS/IPS), running on NFV architecture.
  • Tied in third place:
    • The project team from Technical University of Darmstadt, Germany, demonstrated an advanced remote access database structure in Database Management Systems (DBMS) powered by BlueField DPU.
    • The project team from GreyCortex in the Czech Republic, demonstrated a DPU-based DDoS detection and mitigation system on top of DOCA.

We’d like to congratulate our winners and thank all of the teams that participated, helping to make our first global NVIDIA DPU Hackathon such a wonderful success!

Coming Up: NVIDIA DPU Hackathons in China and North America 

With the European hackathon concluded, our developer relations team is already working on the next leg of our global DPU hackathon tour. NVIDIA is building a broad  community of DOCA developers to create innovative applications and services on top of NVIDIA BlueField DPUs to secure and accelerate modern, efficient data centers. 

Check out our corporate calendar to stay informed with future events, and take part in our journey to reshape the data center of tomorrow. To learn more about the DOCA software framework and to register for early access visit the DOCA webpage.

One of our hackathon participants put it best: “All you need is BlueField-2”