Skip to content

Commit

Permalink
Image classification cpp fix (#2141)
Browse files Browse the repository at this point in the history
* Fixed image_classification/cpp demo

* added input_images.txt with adjusted paths
  • Loading branch information
bstrzele authored and dkalinowski committed Nov 16, 2023
1 parent f4805e9 commit e8125c5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
41 changes: 32 additions & 9 deletions demos/image_classification/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,43 @@ docker run -d -u $(id -u):$(id -g) -v $(pwd)/resnet50-binary:/model -p 9001:9001

## Start the client:
```bash
docker run --rm --network host -e "no_proxy=localhost" ovms_cpp_image_classification ./classification_client_sync --grpc_port=9001 --iterations=10 --layout="binary"
docker run --rm --network host -e "no_proxy=localhost" -v ${PWD}/input_images.txt:/clients/input_images.txt ovms_cpp_image_classification ./classification_client_sync --grpc_port=9001 --iterations=10 --layout="binary"

Address: localhost
Images list path: input_images.txt
Layout: binary
call predict ok
call predict time: 6ms
outputs size is 1
call predict ok
call predict time: 5ms
outputs size is 1
call predict ok
call predict time: 4ms
outputs size is 1
call predict ok
call predict time: 4ms
outputs size is 1
call predict ok
call predict time: 4ms
outputs size is 1
call predict ok
call predict time: 4ms
outputs size is 1
call predict ok
call predict time: 5ms
outputs size is 1
call predict ok
call predict time: 24ms
call predict time: 4ms
outputs size is 1
call predict ok
call predict time: 23ms
call predict time: 4ms
outputs size is 1
call predict ok
call predict time: 23ms
call predict time: 5ms
outputs size is 1
...
Overall accuracy: 90%
Total time divided by number of requests: 25ms
Overall accuracy: 100%
Total time divided by number of requests: 5ms
```

# Clients requesting predictions asynchronously
Expand Down Expand Up @@ -83,7 +106,7 @@ docker run -d -u $(id -u):$(id -g) -v $(pwd)/resnet50-binary:/model -p 9001:9001

### Start the client:
```bash
docker run --rm --network host -e "no_proxy=localhost" ovms_cpp_image_classification ./classification_client_async_benchmark --grpc_port=9001 --layout="nchw" --iterations=2000 --batch_size=1 --max_parallel_requests=100 --consumers=8 --producers=1 --benchmark_mode=1
docker run --rm --network host -e "no_proxy=localhost" -v ${PWD}/input_images.txt:/clients/input_images.txt ovms_cpp_image_classification ./classification_client_async_benchmark --grpc_port=9001 --layout="nchw" --iterations=2000 --batch_size=1 --max_parallel_requests=100 --consumers=8 --producers=1 --benchmark_mode=1

Address: localhost:9001
Model name: resnet
Expand All @@ -103,4 +126,4 @@ Producer threads: 1
Consumer threads: 8
Max parallel requests: 100
Avg FPS: 1012.15
```
```
10 changes: 10 additions & 0 deletions demos/image_classification/cpp/input_images.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
images/airliner.jpeg 404
images/arctic-fox.jpeg 279
images/bee.jpeg 309
images/golden_retriever.jpeg 207
images/gorilla.jpeg 366
images/magnetic_compass.jpeg 635
images/peacock.jpeg 84
images/pelican.jpeg 144
images/snail.jpeg 113
images/zebra.jpeg 340

0 comments on commit e8125c5

Please sign in to comment.