shartoo / spring-boot-tensorflow

a tensorflow detection service
5 stars 3 forks source link
java-tensorflow spring-boot tensorflow

image classify and faster-rcnn detection

Prerequisites

Run

On windows, enter the directory of project and type 'cmd' in the blank nevigate .Then type run command

gradle bootrun

Navigate to http://localhost:8080 and upload an image. The backend will categorize the image and output the result

Run classify

Just clik on the botton classify ,the result will show like this

Run locate and classify

There are some problems for showing the locate and classify result,python code to call the function is below.

import requests

files={'app_id':(None,'123456'),
    'version':(None,'2256'),
    'platform':(None,'linux'),
    'file':open('/home/tao/workspace/imgs/0_frame-0009417_o.jpg','rb')
 }
url = "http://localhost:8080/api/locateAndClassify"
response=requests.post(url,files=files)
print("=======  predict result ========")
print(response.content)

TODO

The current version is a CPU version, a Windows GPU Version is not ready till now. According to tensorflow official words, a tensorflow model cannot be read by Java till version 1.7.

cites

Head to the blog post for the detail about how to do image classify.

thanks

Thanks to @mcjojos, a port to Kotlin is now available in a separate branch. Woot!