Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tika Wiki" for change notification.
The "ImageCaption" page has been changed by ThejanW: https://wiki.apache.org/tika/ImageCaption?action=diff&rev1=3&rev2=4 '''Sample output from API:''' {{{#!json { - "confidence":[ - 0.7843596339225769, - 0.06694009155035019 + "captions":[ + { + "confidence":0.010706593208896654, + "sentence":"a baseball player swinging a bat at a ball" + }, + { + "confidence":0.004686318988055993, + "sentence":"a baseball player swinging a bat at a ball ." + }, + { + "confidence":0.004108484241848782, + "sentence":"a baseball player swinging a bat on a field" + } ], + "beam_size":3, + "max_caption_length":15, - "classnames":[ - "German shepherd, German shepherd dog, German police dog, alsatian", - "military uniform" - ], - "classids":[ - 236, - 653 - ], "time":{ - "read":7403, + "read":1060, + "captioning":570, - "units":"ms", + "units":"ms" - "classification":470 } } }}} @@ -62, +66 @@ 4. Add an appname,Host IP 127.0.0.1 and set both ports to 8764. ===== b. Without Using docker ===== - If you chose to setup REST server without a docker container, you are free to manually install all the required tools specified in the [[ https://github.com/apache/tika/blob/master/tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf/InceptionRestDockerfile | docker file]]. + If you chose to setup REST server without a docker container, you are free to manually install all the required tools specified in the [[ https://github.com/apache/tika/blob/master/tika-parsers/src/main/resources/org/apache/tika/parser/captioning/tf/Im2txtRestDockerfile | docker file]]. Note: docker file has setup instructions for Ubuntu, you will have to transform those commands for your environment. {{{#!highlight bash - python tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf/inceptionapi.py --port 8764 + python tika-parsers/src/main/resources/org/apache/tika/parser/captioning/tf/im2txtapi.py }}} ==== Step 2. Create a Tika-Config XML to enable Tensorflow parser. ==== @@ -79, +83 @@ <parsers> <parser class="org.apache.tika.parser.recognition.ObjectRecognitionParser"> <mime>image/jpeg</mime> + <mime>image/png</mime> + <mime>image/gif</mime> <params> + <param name="apiBaseUri" type="uri">http://localhost:8764/inception/v3</param> - <param name="topN" type="int">2</param> + <param name="captions" type="int">5</param> - <param name="minConfidence" type="double">0.015</param> + <param name="maxCaptionLength" type="int">15</param> - <param name="class" type="string">org.apache.tika.parser.recognition.tf.TensorflowRESTRecogniser</param> + <param name="class" type="string">org.apache.tika.parser.captioning.tf.TensorflowRESTCaptioner</param> </params> </parser> </parsers> @@ -91, +98 @@ '''Description of parameters :''' {{{#!csv - Param Name, Type, Meaning, Range, Example + Param Name, Type, Meaning, Range, Example + apiBaseUri, uri, HTTP URL that will be used to create apiUri & healthUri, any HTTP URL, http://localhost:8764/inception/v3 - topN, int, Number of object names to output, a non-zero positive integer, 1 to receive top 1 object name + captions, int, Number of captions to output, a non-zero positive integer, 3 to recieve 3 captions - minConfidence, double, Minimum confidence required to output the name of detected objects, [0.0 to 1.0] inclusive, 0.9 for outputting object names iff at least 90% confident + maxCaptionLength, int, Maximum length of a caption, a non-zero positive integer(recommended >=15), for 15 the sentence length of a caption won't be greater than 15 - class, string, Name of class that Implements Object recognition Contract, constant string, org.apache.tika.parser.recognition.tf.TensorflowRESTRecogniser + class, string, Name of class that Implements Object recognition Contract, constant string, org.apache.tika.parser.recognition.tf.TensorflowRESTCaptioner - healthUri, URI, HTTP URL to check availability of API service, any HTTP URL that gets 200 status code when available, http://localhost:8764/inception/v4/ping - apiUri, URI, HTTP URL to POST image data, any HTTP URL that returns data in the JSON format as shown in the sample API output, http://localhost:8764/inception/v4/classify?topk=10 }}}
