Serving a Tensorflow CNN model for Hand Detection using Tensorflow Serving
I conducted a hack session at DataHack Summit 2019 on Model Deployment using Tensorflow Serving. Here are the slides - Talk slides
I referred to the following work for training the hand detector model -
Victor Dibia, HandTrack: A Library For Prototyping Real-time Hand TrackingInterfaces using Convolutional Neural Networks, https://github.com/victordibia/handtracking
- ball_with_hand.py - Driver code to run the hand detection model on video frames
- hand_detection_client.py - Classes that enable interation with the model using gRPC or REST
- serving_config.py - Port and host configuration to interact with the served model
- inference_graph - Saved model for Hand Detection
-
Download the sample video
-
Serve the hand detector
docker run -p 8501:8500 -p 9000:8501 \ --mount type=bind,source=/home/tata/Projects/cnn-hand-detector/inference_graph/,target=/models/inference_graph \ --mount type=bind,source=/home/tata/Projects/cnn-hand-detector/inference_graph/model_config.config,target=/models/model_config.config \ -t -i tensorflow/serving --model_config_file=/models/model_config.config --model_config_file_poll_wait_seconds=10 \ --enable_model_warmup=true
Demo of running the command (using Asciinema)
The server can now accept gRPC requests through port 8501 and REST requests through port 9000.
-
Run ball_with_hand.py using either
gRPC
orREST
python3 ball_with_hand.py --method=grpc --video_path=/home/tata/hand_video.mp4
Demo Video -