70 likes | 107 Views
TensorFlow is a open source software library for machine learning, utilized in several of their endeavors and developed by Google. An easy, quick and fun way to start with it's Automation of label missions from Liferay on pictures predicated on a model.
E N D
A Brief on TensorFlow • It is an open source software library for machine learning, developed by Google and currently used in many of their projects. • An easy, fast and fun way to get started with it is – Automation of tag assignments in Liferay on uploaded images based on a pre-trained model. www.enprowess.com sales@enprowess.com +91 80000 22113
LiferayPortal • TensorFlowlibraries: • libtensorflow_jni-1.8.0.jar • libtensorflow-1.8.0.jar • tensorflow-1.8.0.jar Source:https://mvnrepository.com/artifact/org.tensorflow/tensorflow/1.8.0 • Inception5h. • inception5h.zip (Extract it, this contains Graph file, Model directory and Label file) Source:https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip • Liferay7 Source: https://www.liferay.com/downloads www.enprowess.com sales@enprowess.com +91 80000 22113
TensorFlow and Inception Step 1: Portlet developed in Liferay that asks you to upload image. www.enprowess.com sales@enprowess.com +91 80000 22113
TensorFlow-Inception5h Snippet Step 2: Pass on the uploaded image path to LabelImage.class (TensorFlow-Inception5h), which return the metadata of the image. byte[] graphDef = readAllBytesOrExit(Paths.get(MODEL_DIR, GRAPH_FILE)); List labels = readAllLinesOrExit(Paths.get(MODEL_DIR, LABEL_FILE)); byte[] imageBytes = readAllBytesOrExit(Paths.get(imageFile)); try(Tensor image = constructAndExecuteGraphToNormalizeImage(imageBytes)) { float[] labelProbabilities = executeInceptionGraph(graphDef, image); intbestLabelIdx = maxIndex(labelProbabilities); metadata = labels.get(bestLabelIdx); String output = String.format(“BEST MATCH: %s (%.2f%% likely)”, metadata, labelProbabilities[bestLabelIdx] * 100f); } www.enprowess.com sales@enprowess.com +91 80000 22113
TensorFlow Result Step 3: Image is stored in Liferay in with relevant folder, along with metadata tags. www.enprowess.com sales@enprowess.com +91 80000 22113
Where to find Liferay Services? • Liferay is open source platform and free enterprise portal which is used by “Enprowess Technologies” for meeting user’s requirements. • Situated in Ahmedabad – India, Enprowess is a global company providing IT solutions. • We at Enprowess deliver solutions as Liferay , Alfresco , Activiti , Full Stack Java , Mobile Application Development and so on. Visit Enprowess