How HBO’s Silicon Valley built “Not Hotdog” with mobile TensorFlow, Keras & React Native

How HBO’s Silicon Valley built “Not Hotdog” with mobile TensorFlow, Keras & React Native

  • While this is a subject of some debate these days, our experiments placing BN after activation on small networks failed to converge as well.To optimize the network we used Cyclical Learning Rates and (fellow student) Brad Kenstler’s excellent Keras implementation.
  • This was hard to defend against as a) there just aren’t that many photographs of hotdogs in soft focus (we get hungry just thinking about it) and b) it could be damaging to spend too much of our network’s capacity training for soft focus, when realistically most images taken with a mobile phone will not have that feature.
  • Of the remaining 147k images, most were of food, with just 3k photos of non-food items, to help the network generalize a bit more and not get tricked into seeing a hotdog if presented with an image of a human in a red outfit.Our data augmentation rules were as follows:We applied rotations within Âą135 degrees — significantly more than average, because we coded the application to disregard phone orientation.Height and width shifts of 20%Shear range of 30%Zoom range of 10%Channel shifts of 20%Random horizontal flips to help the network generalizeThese numbers were derived intuitively, based on experiments and our understanding of the real-life usage of our app, as opposed to careful experimentation.The final key to our data pipeline was using Patrick Rodriguez’s multiprocess image data generator for Keras.
  • Phase 2 ran for 64 more epochs (4 CLR cycles with a step size of 8 epochs), with a learning rate between 0.0004 and 0.0045, on a triangular 2 policy.Phase 3 ran for 64 more epochs (4 CLR cycles with a step size of 8 epochs), with a learning rate between 0.000015 and 0.0002, on a triangular 2 policy.While learning rates were identified by running the linear experiment recommended by the CLR paper, they seem to intuitively make sense, in that the max for each phase is within a factor of 2 of the previous minimum, which is aligned with the industry standard recommendation of halving your learning rate if your accuracy plateaus during training.We were able to perform some runs on a Paperspace P5000 instance in the interest of time.
  • In those cases, we were able to double the batch size, and found that optimal learning rates for each phase were roughly double as well.Running Neural Networks on Mobile PhonesEven having designed a relatively compact neural architecture, and having trained it to handle situations it may find in a mobile context, we had a lot of work left

How Silicon Valley build the real AI app that identifies hotdogs — and not hotdogs using mobile TensorFlow, Keras & React Native.
Continue reading “How HBO’s Silicon Valley built “Not Hotdog” with mobile TensorFlow, Keras & React Native”

Techniques for decomposing React components – DailyJS – Medium

Techniques for decomposing #ReactJS components:  by @Dvtng #JavaScript

  • Here are three techniques to get you started, from the simplest to most advanced.Split the render() methodThis is the most obvious technique to apply: when a component renders too many elements, splitting those elements into logical sub-components is an easy way to simplify.A common and quick way to split the render() method is to create additional “sub-render” methods on the same class:While this can have its place, it is not a true decomposition of the component itself.
  • As a bonus, when React’s new Fiber architecture arrives, the smaller units will allow it to perform incremental rendering more effectively.Templatize components by passing React elements as propsIf a component is becoming too complex due to multiple variations or configurations, consider turning the component into a simple “template” component with one or more open “slots”.
  • Utilise the ability of React to pass elements, not just data, as props, to create a flexible template component.Another component can then have the sole responsibility of figuring out what to fill the metadata and actions slots with.Keep in mind that in JSX, anything that’s between the opening and closing tags of a component is passed as the special children prop.
  • In the comments example, this would likely be the text of the comment itself.Extract common aspects into higher-order componentsComponents can often become polluted by cross-cutting concerns that aren’t directly related to its main purpose.Suppose you wanted to send analytics data whenever a link in a Document component is clicked.
  • The obvious solution might be to add code to Document’s componentDidMount and componentWillUnmount lifecycle methods, like so:There are a few problems with this:The component now has an extra concern that obscures its main purpose: displaying a document.If the component has additional logic in those lifecycle methods, the analytics code also becomes obscured.The analytics code is not reusable.Refactoring the component is made harder, as you’d have to work around the analytics code.Decomposition of aspects such as this one can be done using higher-order components (HOCs).

React components have a lot of power and flexibility. With so many tools at your disposal, it is incredibly easy for components to grow over time, become bloated and do too much. As with any other…
Continue reading “Techniques for decomposing React components – DailyJS – Medium”

Best practices for JavaScript function parameters

  • The problem with passing an object as a parameter to a function is that it’s not clear what values you should put into it.
  • One common thing in FP is to partially apply your functions, which is much harder to do if your function takes its parameters as an object.
  • While separate parameters are a good starting point, we run into trouble as soon as the function has optional parameters.
  • For functions with a single optional parameter, the solution is simple:

    Best practice: optionals come last

    However, if we have more than one optional parameter, the problem is… what if we only need to pass one optional parameter?

  • You can pass in parameters easily as an object, but the properties for the object can be easily seen from the function’s signature.

From time to time, people ask things like “should I use objects to pass function arguments”. I’m sure you recognize the pattern, as it’s common with many libraries:
Continue reading “Best practices for JavaScript function parameters”

Super Powered Single Page Apps with React, WordPress and GraphQL by Jason Bahl

  • GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.
  • GraphQL provides a complete

    and understandable description of the data in your API, gives

    clients the power to ask for exactly what they need and

    nothing more, makes it easier to evolve APIs over time, and

A presentation created with Slides.
Continue reading “Super Powered Single Page Apps with React, WordPress and GraphQL by Jason Bahl”

Reactjs Development Services India

#ReactJS has proven to be one of best #Javascript front-end library

   #webdev

  • ReactJS has proven to be one of the best frameworks out there and that is visible by the adaptability of the same by world famous companies.
  • It gives a near perfect experience for the client as well as the developer and ensures that interfaces built on it are not only great in performance but are also visually appealing.
  • Techuz has provided reactjs web development services to various clients all of which have been amazed by the technology.

Hire dedicated reactjs developer from top reactjs web & mobile application development company India Techuz. we have expert reactjs team for innovative solutions.
Continue reading “Reactjs Development Services India”

Navi Case Study – Mark Pinero – Medium

Navi Case Study: What you can learn from building a full-stack #ReactJS app

  • Navi Case StudyWhat I learned from building a full-stack React appThe initial idea I came up with was a meditation app that scored you based on how long you meditated each time.
  • Using Navi, the character from the Legend of Zelda: Ocarina of Time, I began with a concept of something guiding you to a better life.
  • The initial prototype worked, albeit performed poorly.Developing the API was very straight-forward since I have written it many times.
  • My initial prototype rendered equal weeks per year, but leap years ruin the implementation.
  • Implementing the initial design first would have sped up development by at least a week.Takeaways:Start with an initial design first, implement, then iterate.Server-side rendering for improved SEO and hard links.Create better algorithms, quick sort due to likely random user input, for user data functions.

The initial idea I came up with was a meditation app that scored you based on how long you meditated each time. Using Navi, the character from the Legend of Zelda: Ocarina of Time, I began with a…
Continue reading “Navi Case Study – Mark Pinero – Medium”

React: Load Global JavaScript Library with Webpack – Xiao Ling – Medium

React: Load Global JavaScript Library with Webpack  #react #javascript #webpack #reactjs

  • React: Load Global JavaScript Library with WebpackWhen using React and Dynamic Web TWAIN to create a web document scanning app, I was confused about how to load dynamsoft.webtwain.min.js, a global JavaScript library like jQuery, into my project.
  • In this article, I will share not only the solutions but also the issues I met.Three Ways to Import Global JavaScript Libraries into React ProjectComparing to Angular, loading global JavaScript library is more tricky in React.Insert JS link into HTML script elementWebpack is just a module bundler that packs all modules with dependencies into one bundle, which is still a JavaScript file.
  • According to the React component lifecycle, we can write the code in method {var script = = approach is not suitable for loading a local JavaScript library file.Manually export moduleTo load a module in JavaScript, we can use require().
  • The reason is dynamsoft.webtwain.min.js is a global JavaScript library, not a module.
  • Only exported modules are accessible.To make the code work, we can add ‘module.exports = Dynamsoft’ to the bottom of and then rebuild the React project.The variable ‘Dynamsoft’ makes sense now.Configure webpack.config.jsThe above approach which changes the original JavaScript library is apparently not good.

When using React and Dynamic Web TWAIN to create a web document scanning app, I was confused about how to load dynamsoft.webtwain.min.js, a global JavaScript library like jQuery, into my project. I…
Continue reading “React: Load Global JavaScript Library with Webpack – Xiao Ling – Medium”