TensorFlow Object Recognition Service
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
tfors is a service that performs object recongition on images sent by a client. tfors let's you centralize any machine learning you have in your environment by having clients send images to a centralized server, perform object recognition, and then return the results to the client.
Recommended way to host tfors https://hub.docker.com/r/tuxthepenguin/tfors
- Install pre-reqs
apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python-is-python3 \
build-essential \
python3-dev \
git \
protobuf-compiler \
apt-transport-https \
ca-certificates
- Configure Object Detection & PIP packages
git clone --depth 1 https://github.com/tensorflow/models
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install .
pip install httplib2
python server.py -m "https://tfhub.dev/tensorflow/centernet/resnet50v1_fpn_512x512/1" -l "C:\Users\Sam\Documents\git\tfors\mscoco_label_map.pbtxt" -d
parser.add_argument("-p", "--port", help="TCP Port to listen on. Example: 4949", type=int, default=4949)
parser.add_argument("-b", "--buffer", help="Buffer size. Example: 4096", type=int, default=4096)
parser.add_argument("-m", "--model", help="TensorFlow Hub model to use for inference. Example: https://tfhub.dev/tensorflow/centernet/resnet50v1_fpn_512x512/1 or /path/to/centernet_resnet50v1_fpn_512x512_1", required=True)
parser.add_argument("-l", "--labels", help="Labels mapping file. Example: /path/to/mscoco_label_map.pbtxt or C:\path\to\mscoco_label_map.pbtxt", required=True)
parser.add_argument("-e", "--encoding", help="Set encoding. | Example : utf-8", default='utf-8')
parser.add_argument("-d", "--logging", help="Output logging information.", default=False, action='store_true')
git clone https://github.com/tuxthepenguin84/tfors.git
python client.py -f path\to\image.jpg -s server_ip
parser.add_argument("-f", "--file", help="Path to file, also accepts pipeline input", default=None) # accepts pipeline input
parser.add_argument("-s", "--server", help="The host/IP address of the server, required.", required=True)
parser.add_argument("-p", "--port", help="TCP Port to send to. | Example (default): 4949", type=int, default=4949)
parser.add_argument("-b", "--buffer", help="Buffer size. | Example (default): 4096", type=int, default=4096)
parser.add_argument("-e", "--encoding", help="Set encoding. | Example (default): utf-8", default='utf-8')
parser.add_argument("-c", "--objectclass", help="Object class(s) to recognize. | Example 1: cat | Example 2: car airplane 'potted plant' chair | Notes: When using multiple object classes, --maxresults is ignored", nargs='+', default=None)
parser.add_argument("-x", "--detectionbox", help="Detection box size (0.0 min - 1.0 max) [y_min, x_min, y_max, x_max] | Example : 0.0 0.0 0.5 0.5", nargs='+', default=None)
parser.add_argument("-m", "--minscore", help="Minimum detection score (percent). | Example (default): 60", type=int, default=60)
parser.add_argument("-a", "--maxresults", help="Max results returned. | Example (default): 1", type=int, default=1)
parser.add_argument("-u", "--output", help="Output type: silent, simple, detailed, json, onlyclass, onlyscore, onlybox, onlyclassfound, onlywithinbox, raw. | Example (default): simple", default="simple")
parser.add_argument("-d", "--logging", help="Output logging information.", default=False, action='store_true')
See: tfors.service file
- Return data to client in JSON format
- Return all inferenced class, score, and bounding box data to client
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Sam Dockery - @SFTuxTweet - samueldockery@gmail.com
Project Link: https://github.com/tuxthepenguin84/tfors