DZone
Web Dev Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Web Dev Zone > Machine Learning and React Native: Feasible for Web Development?

Machine Learning and React Native: Feasible for Web Development?

Machine Learning isn't just meant for big machines with lots of GPUs. What if you can execute ML models on your phone! And with React Native it's not all that hard!

Chris Bateson user avatar by
Chris Bateson
·
Nov. 15, 21 · Web Dev Zone · Code Snippet
Like (3)
Save
Tweet
22.98K Views

Join the DZone community and get the full member experience.

Join For Free

Unless you have been living under a rock, there is no way you have not heard of at least artificial intelligence. Of course, this is because of the potent tool it has proven to be over the past decade. This popularity, then, led to the emergence of machine learning as well as deep learning. Now, they are both technically subsets of artificial intelligence, but the plethora of their advantages have ensured they were each able to establish their distinct identities in the market. Now, machine learning serves to help systems use input data to improve themselves. 

Meanwhile, deep learning, which involves the use of algorithms based on the human brain’s structure and function, is enabling the achievement of unparalleled results in computer vision, ML, etc.

This leads us to the question, what tools can one use to put these avant-garde technologies to work for them? Of course, the market has plenty of options to offer as well, with each promising to enable the development of some of the finest tools and solutions are driven by machine learning and deep learning. Machine Learning as you might be aware might sound like it is just meant for big machines with lots of GPUs. But what if you can execute ML models on your phone! And with React Native it's not all that hard! But can we use ML in react native? 

Yet, there is one name that has consistently fared as the top choice for developers and companies working to embrace these technologies: React Native. This is not surprising at all though, especially when you consider just how much React Native can help in this regard. From the design model in Python and loading pre-trained models to building the tailored React Native component to leveraging the neural network for presentation, the process may seem complex on the outset, but can be simpler and much more rewarding than imagined.

Of course, one needs other tools to develop neural networks. TensorFlow is widely accepted to be among the top options in the market. The React Native TensorFlow open-source library includes two APIs: one for direct TensorFlow interaction and one image recognition API. 

Here is how one can use the image recognition API. 

    1. Make an rn-cli.config.js file in the project’s root, then add the TensorFlow model as well as the Label file.

module.exports = {   getAssetExts() {     return ['pb', 'txt']   } }

    2. TensorFlow and Label model file: Next step is to add the TensorFlow model file to the assets. After that, add the label file to the assets.

tensorflow_inception_graph.pb 

tensorflow_labels.txt 

    3. Time to kick off the tfImageRecognition API class: Use the model and the label to put the tfImageRecognition API to work.

const tfImageRecognition = new tfImageRecognition({   model: require('./assets/tensorflow_inception_graph.pb'),   labels: require('./assets/tensorflow_labels.txt'), }); 

    4. Call the recognize function: 

const results = await ifImageRecognition.recognize({   image: require('./assets/panda.jpg'), }); 

There is no doubt that as time progresses, we will find more intricate and better uses for the trio of artificial intelligence, machine learning, and deep learning. As the world comes to rely on this set of technologies in a variety of aspects, we will also need other tools and solutions to access these technologies and properly put them to work for us. 

Conclusion 

As the above discussion demonstrates, the aforementioned framework is very well among the top choices for developers working on integrating machine learning and deep learning with React Native apps. Anyone seeking to put these technologies to work for them would do well to consider React Native as their choice of tool. 

Do you have alternate views on this topic on how to make this happen? Let me know your thoughts.

Machine learning React Native React (JavaScript library)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The Evolution of Configuration Management: IaC vs. GitOps
  • The Right Way to Hybridize Your Product Development Technique
  • Maven Tutorial: Nice and Easy [Video]
  • Top Six Kubernetes Best Practices for Fleet Management

Comments

Web Dev Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo