Skip to content

Commit 2388a25

Browse files
authored
test: download test fixtures differently (#140)
* Retrieve OpenVINO test artifacts from https://download.01.org/ This change is a necessary precursor for removing the Git LFS support in this repository and properly caching these artifacts in GitHub actions.
1 parent 72d7560 commit 2388a25

33 files changed

+176
-19841
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ jobs:
3939
- uses: actions/checkout@v2
4040
with:
4141
submodules: true
42-
lfs: true
43-
- name: Checkout LFS objects
44-
run: git lfs checkout
42+
- uses: actions/[email protected]
43+
with:
44+
key: openvino-test-fixtures
45+
path: |
46+
crates/openvino/tests/fixtures/alexnet
47+
crates/openvino/tests/fixtures/inception
48+
crates/openvino/tests/fixtures/mobilenet
4549
- uses: abrown/install-openvino-action@v8
4650
with:
4751
version: ${{ matrix.version }}
@@ -92,7 +96,6 @@ jobs:
9296
- uses: actions/checkout@v2
9397
with:
9498
submodules: true
95-
lfs: true
9699
- name: Build documentation
97100
run: cargo doc --no-deps --features openvino-sys/runtime-linking
98101

README.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,24 @@ crate (high-level, ergonomic bindings) for accessing OpenVINO™ functionality i
2020
1. The [openvino-sys] crate creates bindings to the OpenVINO™ C API using `bindgen`; this requires a
2121
local installation of `libclang`. Also, be sure to retrieve all Git submodules.
2222

23-
2. This repo currently uses [git-lfs](https://git-lfs.github.com/) for large file storage. If you
24-
[install it](https://github.com/git-lfs/git-lfs/wiki/Installation) before cloning this
25-
repository, it should have downloaded all large files. To check this, verify that `find
26-
crates/openvino -name *.bin | xargs ls -lhr` returns `.bin` files of tens of megabytes. If not,
27-
download the large files with:
28-
29-
```shell
30-
git lfs fetch
31-
git lfs checkout
32-
```
33-
34-
3. This library binds to OpenVINO™'s shared libraries; how those native libraries are configured and
23+
2. This library binds to OpenVINO™'s shared libraries; how those native libraries are configured and
3524
installed on your system determines how these Rust bindings work. The [openvino-finder] crate
3625
attempts to locate the necessary libraries and configuration; if you run into problems, you may
3726
need to understand additional details documented in the [`openvino-finder`
3827
docs][openvino-finder-docs].
3928

4029
[openvino-finder-docs]: https://docs.rs/openvino-finder
4130

42-
4. __For macOS (homebrew) users__. Install the openvino toolkit, which includes the native C library,
43-
and set `DYLD_LIBRARY_PATH`:
31+
3. During testing only, this library will download several models for its integration tests. This
32+
relies on `curl` being available on the system path.
33+
34+
4. __For macOS (homebrew) users__. Install the openvino toolkit, which includes the native C
35+
library, and set `DYLD_LIBRARY_PATH`:
4436
```
45-
brew install openvino
46-
export DYLD_LIBRARY_PATH="$(brew --prefix)/lib"
37+
brew install openvino
38+
export DYLD_LIBRARY_PATH="$(brew --prefix)/lib"
4739
```
48-
Then you can build and run openvino-rs for [runtime linking](#build-for-runtime-linking).
40+
Then you can build and run using [runtime linking](#build-for-runtime-linking).
4941

5042
### Build from an OpenVINO™ installation
5143

crates/openvino/tests/classify-alexnet.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
//! Demonstrates using `openvino-rs` to classify an image using an AlexNet model and a prepared input tensor. See
2-
//! [README](fixtures/alexnet/README.md) for details on how this test fixture was prepared.
1+
//! Demonstrates using `openvino` to classify an image using an AlexNet model and a prepared input
2+
//! tensor.
3+
34
mod fixtures;
45
mod util;
56

67
use anyhow::Ok;
7-
use fixtures::alexnet::Fixture;
8+
use fixtures::alexnet as fixture;
89
use openvino::{
910
prepostprocess, Core, DeviceType, ElementType, Layout, ResizeAlgorithm, Shape, Tensor,
1011
};
@@ -15,16 +16,16 @@ use util::{Prediction, Predictions};
1516
fn classify_alexnet() -> anyhow::Result<()> {
1617
let mut core = Core::new()?;
1718
let mut model = core.read_model_from_file(
18-
&Fixture::graph().to_string_lossy(),
19-
&Fixture::weights().to_string_lossy(),
19+
&fixture::graph().to_string_lossy(),
20+
&fixture::weights().to_string_lossy(),
2021
)?;
2122

2223
let output_port = model.get_output_by_index(0)?;
2324
assert_eq!(output_port.get_name()?, "prob");
2425
assert_eq!(model.get_input_by_index(0)?.get_name()?, "data");
2526

2627
// Retrieve the tensor from the test fixtures.
27-
let data = fs::read(Fixture::tensor())?;
28+
let data = fs::read(fixture::tensor())?;
2829
let input_shape = Shape::new(&[1, 227, 227, 3])?;
2930
let element_type = ElementType::F32;
3031
let mut tensor = Tensor::new(element_type, &input_shape)?;

crates/openvino/tests/classify-inception.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
//! Demonstrates using `openvino-rs` to classify an image using an Inception SSD model and a prepared input tensor. See
2-
//! [README](fixtures/inception/README.md) for details on how this test fixture was prepared.
1+
//! Demonstrates using `openvino` to classify an image using an Inception SSD model and a prepared
2+
//! input tensor.
3+
34
mod fixtures;
45
mod util;
56

67
use anyhow::Ok;
7-
use fixtures::inception::Fixture;
8+
use fixtures::inception as fixture;
89
use openvino::{
910
prepostprocess, Core, DeviceType, ElementType, Layout, ResizeAlgorithm, Shape, Tensor,
1011
};
@@ -15,16 +16,16 @@ use util::{Prediction, Predictions};
1516
fn classify_inception() -> anyhow::Result<()> {
1617
let mut core = Core::new()?;
1718
let mut model = core.read_model_from_file(
18-
&Fixture::graph().to_string_lossy(),
19-
&Fixture::weights().to_string_lossy(),
19+
&fixture::graph().to_string_lossy(),
20+
&fixture::weights().to_string_lossy(),
2021
)?;
2122

2223
let output_port = model.get_output_by_index(0)?;
2324
assert_eq!(output_port.get_name()?, "InceptionV3/Predictions/Softmax");
2425
assert_eq!(model.get_input_by_index(0)?.get_name()?, "input");
2526

2627
// Retrieve the tensor from the test fixtures.
27-
let data = fs::read(Fixture::tensor())?;
28+
let data = fs::read(fixture::tensor())?;
2829
let input_shape = Shape::new(&[1, 299, 299, 3])?;
2930
let element_type = ElementType::F32;
3031
let mut tensor = Tensor::new(element_type, &input_shape)?;

crates/openvino/tests/classify-mobilenet.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//! Demonstrates using `openvino-rs` to classify an image using an MobileNet model and a prepared
2-
//! input tensor. See [README](fixtures/inception/README.md) for details on how this test fixture
3-
//! was prepared.
1+
//! Demonstrates using `openvino` to classify an image using an MobileNet model and a prepared input
2+
//! tensor.
3+
44
mod fixtures;
55
mod util;
66

7-
use fixtures::mobilenet::Fixture;
7+
use fixtures::mobilenet as fixture;
88
use openvino::{
99
prepostprocess, Core, DeviceType, ElementType, Layout, ResizeAlgorithm, Shape, Tensor,
1010
};
@@ -15,16 +15,16 @@ use util::{Prediction, Predictions};
1515
fn classify_mobilenet() -> anyhow::Result<()> {
1616
let mut core = Core::new()?;
1717
let mut model = core.read_model_from_file(
18-
&Fixture::graph().to_string_lossy(),
19-
&Fixture::weights().to_string_lossy(),
18+
&fixture::graph().to_string_lossy(),
19+
&fixture::weights().to_string_lossy(),
2020
)?;
2121

2222
let output_port = model.get_output_by_index(0)?;
2323
assert_eq!(output_port.get_name()?, "MobilenetV2/Predictions/Reshape_1");
2424
assert_eq!(model.get_input_by_index(0)?.get_name()?, "input");
2525

2626
// Retrieve the tensor from the test fixtures.
27-
let data = fs::read(Fixture::tensor())?;
27+
let data = fs::read(fixture::tensor())?;
2828
let input_shape = Shape::new(&[1, 224, 224, 3])?;
2929
let element_type = ElementType::F32;
3030
let mut tensor = Tensor::new(element_type, &input_shape)?;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore all downloaded artifacts in this directory (see `../mod.rs`) except this file.
2+
*
3+
!.gitignore

crates/openvino/tests/fixtures/alexnet/README.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

crates/openvino/tests/fixtures/alexnet/alexnet.bin

Lines changed: 0 additions & 3 deletions
This file was deleted.

crates/openvino/tests/fixtures/alexnet/alexnet.mapping

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)