limit supported formats by MNIST database only, added lenet.labels file (#7947)
* limit supported formats by NIST database only, added lenet.labels file * shortened line * apply code style fix
This commit is contained in:
parent
25c2d5c6c4
commit
9e1231ac8d
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This sample demonstrates how to execute an synchronous inference using [nGraph function feature](../../../docs/nGraph_DG/build_function.md) to create a network, which uses weights from LeNet classification network, which is known to work well on digit classification tasks.
|
This sample demonstrates how to execute an synchronous inference using [nGraph function feature](../../../docs/nGraph_DG/build_function.md) to create a network, which uses weights from LeNet classification network, which is known to work well on digit classification tasks.
|
||||||
|
|
||||||
The sample supports only single-channel `ubyte` images as an input.
|
The sample supports only single-channel [MNIST database](http://yann.lecun.com/exdb/mnist) images as an input.
|
||||||
|
|
||||||
You do not need an XML file to create a network. The API of ngraph::Function allows to create a network on the fly from the source code.
|
You do not need an XML file to create a network. The API of ngraph::Function allows to create a network on the fly from the source code.
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ Basic Inference Engine API is covered by [Hello Classification C++ sample](../he
|
|||||||
|:--- |:---
|
|:--- |:---
|
||||||
| Validated Models | LeNet
|
| Validated Models | LeNet
|
||||||
| Model Format | Network weights file (\*.bin)
|
| Model Format | Network weights file (\*.bin)
|
||||||
| Validated images | single-channel `ubyte` images
|
| Validated images | single-channel `MNIST ubyte` images
|
||||||
| Supported devices | [All](../../../docs/IE_DG/supported_plugins/Supported_Devices.md) |
|
| Supported devices | [All](../../../docs/IE_DG/supported_plugins/Supported_Devices.md) |
|
||||||
| Other language realization | [Python](../../ie_bridges/python/sample/ngraph_function_creation_sample/README.md) |
|
| Other language realization | [Python](../../ie_bridges/python/sample/ngraph_function_creation_sample/README.md) |
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ To build the sample, please use instructions available at [Build the Sample Appl
|
|||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
To run the sample, you need specify a model wights and ubyte image:
|
To run the sample, you need specify a model wights and MNIST ubyte image:
|
||||||
|
|
||||||
- you can use LeNet model weights in the sample folder: `lenet.bin` with FP32 weights file
|
- you can use LeNet model weights in the sample folder: `lenet.bin` with FP32 weights file
|
||||||
- you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data.
|
- you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data.
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
0
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
@ -338,6 +338,12 @@ int main(int argc, char* argv[]) {
|
|||||||
slog::warn << "Image " + i + " cannot be read!" << slog::endl;
|
slog::warn << "Image " + i + " cannot be read!" << slog::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reader->size() != inputInfoItem.second->getTensorDesc().getDims()[2] *
|
||||||
|
inputInfoItem.second->getTensorDesc().getDims()[3]) {
|
||||||
|
throw std::logic_error("Not supported format. Only MNist ubyte images supported.");
|
||||||
|
}
|
||||||
|
|
||||||
/** Store image data **/
|
/** Store image data **/
|
||||||
std::shared_ptr<unsigned char> data(reader->getData(inputInfoItem.second->getTensorDesc().getDims()[3],
|
std::shared_ptr<unsigned char> data(reader->getData(inputInfoItem.second->getTensorDesc().getDims()[3],
|
||||||
inputInfoItem.second->getTensorDesc().getDims()[2]));
|
inputInfoItem.second->getTensorDesc().getDims()[2]));
|
||||||
|
Loading…
Reference in New Issue
Block a user