Comments (2)
I will take a look when I get a second. Sorry, am quite busy ATM.
from rude-carnie.
I added an exporter for TF serving as you suggested:
This should also resolve the questions you had about how to export it to TF serving.
To run it with tensorflow serving steps I did:
First export the model:
dpressel@dpressel:~/dev/work/rude-carnie$ python export.py --model_type inception --model_dir /data/xdata/rude-carnie/checkpoints/age/inception/22801 --output /tmp/age
2017-06-21 11:45:30.503473: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:893] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-06-21 11:45:30.503847: I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] Found device 0 with properties:
name: GeForce GTX 980M
major: 5 minor: 2 memoryClockRate (GHz) 1.1265
pciBusID 0000:01:00.0
Total memory: 7.93GiB
Free memory: 7.09GiB
2017-06-21 11:45:30.503883: I tensorflow/core/common_runtime/gpu/gpu_device.cc:927] DMA: 0
2017-06-21 11:45:30.503889: I tensorflow/core/common_runtime/gpu/gpu_device.cc:937] 0: Y
2017-06-21 11:45:30.503895: I tensorflow/core/common_runtime/gpu/gpu_device.cc:996] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 980M, pci bus id: 0000:01:00.0)
selected (fine-tuning) inception model
/data/xdata/rude-carnie/checkpoints/age/inception/22801/checkpoint-14999
Restored model checkpoint /data/xdata/rude-carnie/checkpoints/age/inception/22801/checkpoint-14999
Exporting trained model to b'/tmp/age/1'
WARNING:tensorflow:Error encountered when serializing LAYER_NAME_UIDS.
Type is unsupported, or the types of the items don't match field type in CollectionDef.
'dict' object has no attribute 'name'
Successfully exported model to /tmp/age
The exporter is based on:
https://github.com/tensorflow/serving/blob/master/tensorflow_serving/example/inception_client.py
Now serve the model from tensorflow_serving directory:
dpressel@dpressel:~/dev/work/serving$ bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server --port=9000 --model_name=age --model_base_path=/tmp/age/
...
2017-06-21 11:45:58.713786: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:146] Restoring SavedModel bundle.
2017-06-21 11:45:59.194215: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:181] Running LegacyInitOp on SavedModel bundle.
2017-06-21 11:45:59.249601: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:275] Loading SavedModel: success. Took 814539 microseconds.
2017-06-21 11:45:59.249658: I tensorflow_serving/core/loader_harness.cc:86] Successfully loaded servable version {name: age version: 1}
2017-06-21 11:45:59.263568: I tensorflow_serving/model_servers/main.cc:298] Running ModelServer at 0.0.0.0:9000 ...
Here is a sample client to run:
https://gist.github.com/dpressel/6d77c89203576ac3d5e35237c0f4f94f
dpressel@dpressel:~/dev/work/tf-serving-py$ python client.py --image ~/Downloads/portraits/biebs.jpg
outputs {
key: "classes"
value {
dtype: DT_STRING
tensor_shape {
dim {
size: 1
}
dim {
size: 2
}
}
string_val: "(15, 20)"
string_val: "(25, 32)"
}
}
outputs {
key: "scores"
value {
dtype: DT_FLOAT
tensor_shape {
dim {
size: 1
}
dim {
size: 2
}
}
float_val: 0.8679360747337341
float_val: 0.06530137360095978
}
}
Note that running this is equivalent to running guess.py
with --single_look
(it doesnt do the multi-crop approach which is the default in guess.py
)
from rude-carnie.
Related Issues (20)
- where is the folder /AgeGenderDeepLearning/Folds/tf/age_test_fold_is_1/run-20854 ? HOT 1
- how to use the guess.py with pre-trained model ? HOT 4
- how to change the script if I use MTCNN to detect the face ? HOT 4
- no gender in output HOT 1
- Using the gender detection model on tf 2.0 HOT 2
- Issue Training Gender HOT 2
- Where is the pruning process for the Tensorflow code?
- Running in Realtime
- Adding a licence
- name 'ImageCoder' is not defined HOT 2
- Cannot work on GPU and ask for Requirements
- Gender Classification Confusion Matrix
- batch size issue when freeze the graph
- python train.py HOT 2
- eval.py display accuracy
- test datasets HOT 1
- Custom Face Detector HOT 3
- Gender detection does not work correctly HOT 1
- Output node name to create a frozen graph
- who has the dataset ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rude-carnie.