-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into mxnet_quantization
- Loading branch information
Showing
13 changed files
with
628 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
FROM ubuntu_for_dli | ||
|
||
WORKDIR /root/ | ||
|
||
ARG TORCH_VERSION=2.0.1 | ||
ARG TORCHVISION_VERSION=0.15.2 | ||
ARG OCV_VERSION=4.7.0 | ||
ARG CMAKE_VERSION=3.24 | ||
|
||
# Install cmake | ||
WORKDIR /tmp/ | ||
RUN pip3 install --upgrade pip | ||
RUN pip3 install cmake==${CMAKE_VERSION} | ||
|
||
# Install OpenCV using C++ build | ||
WORKDIR /tmp/ | ||
RUN git clone --recurse-submodules https://github.com/opencv/opencv.git --depth 1 --branch ${OCV_VERSION} --single-branch | ||
ENV OpenCV_BUILD_DIR=/tmp/build-opencv | ||
RUN mkdir $OpenCV_BUILD_DIR | ||
WORKDIR $OpenCV_BUILD_DIR | ||
RUN /bin/bash -c 'cmake -G Ninja \ | ||
-D CMAKE_INSTALL_PREFIX=install \ | ||
-D CMAKE_BUILD_TYPE=Release \ | ||
-D BUILD_EXAMPLES=OFF \ | ||
-D BUILD_TESTS=OFF \ | ||
-D BUILD_DOCS=OFF \ | ||
-D OPENCV_LIB_INSTALL_PATH=lib \ | ||
-D OPENCV_CONFIG_INSTALL_PATH=cmake \ | ||
-D PYTHON3_PACKAGES_PATH=install/python/python3 \ | ||
/tmp/opencv/ && ninja && cmake --install .' && \ | ||
rm -r /tmp/opencv | ||
ENV OpenCV_INSTALL_DIR="$OpenCV_BUILD_DIR/install" | ||
ENV OpenCV_DIR="$OpenCV_INSTALL_DIR/cmake" | ||
ENV LD_LIBRARY_PATH="$OpenCV_INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" | ||
ENV PYTHONPATH="$OpenCV_INSTALL_DIR/python/python3/cv2/python-3.8${PYTHONPATH:+:$PYTHONPATH}" | ||
|
||
# Install PyTorch using C++ build | ||
WORKDIR /tmp/ | ||
RUN git clone --recurse-submodules https://github.com/pytorch/pytorch --depth 1 --branch v${TORCH_VERSION} --single-branch | ||
RUN pip3 install -r ./pytorch/requirements.txt | ||
ENV TORCH_BUILD_DIR=/tmp/build-torch | ||
RUN mkdir $TORCH_BUILD_DIR | ||
WORKDIR $TORCH_BUILD_DIR | ||
RUN cmake \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DPYTHON_EXECUTABLE=`which python3` \ | ||
-DCMAKE_INSTALL_PREFIX=install \ | ||
/tmp/pytorch && cmake --build . --target install -- -j$(nproc --all) && rm -r /tmp/pytorch | ||
ENV TORCH_INSTALL_DIR="$TORCH_BUILD_DIR/install" | ||
|
||
# Install PyTorch Python | ||
RUN pip3 install torch==${TORCH_VERSION} \ | ||
torchvision==${TORCHVISION_VERSION} | ||
|
||
# Build Benchmark C++ | ||
WORKDIR /tmp/ | ||
RUN cd dl-benchmark && git submodule update --init && cd .. | ||
RUN mkdir benchmark_build && cd benchmark_build && \ | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DBUILD_PYTORCH_LAUNCHER=ON \ | ||
-DTorch_DIR="$TORCH_INSTALL_DIR/share/cmake/Torch/" \ | ||
/tmp/dl-benchmark/src/cpp_dl_benchmark && cmake --build . -- -j$(nproc --all) | ||
|
||
# Install Accuracy Checker | ||
ENV ACCURACY_CHECKER_PATH=/tmp/open_model_zoo/tools/accuracy_checker | ||
WORKDIR $ACCURACY_CHECKER_PATH | ||
COPY config.yml config.yml | ||
# make module path relative in config | ||
ARG MODELS_DIR=$ACCURACY_CHECKER_PATH/data/test_models | ||
RUN sed -i 's|MODELS_DIR|'${MODELS_DIR}'|g' config.yml | ||
|
||
# please uncomment out when OMZ version will be >=2023.0 (see commit: a89aade) | ||
# RUN python3 setup.py install_core; \ | ||
# accuracy_check -c config.yml -m data/test_models -s sample | ||
|
||
WORKDIR /tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
models: | ||
- name: SampLeNet | ||
launchers: | ||
- framework: pytorch | ||
device: cpu | ||
module: samplenet.SampLeNet | ||
checkpoint: MODELS_DIR/pytorch_model/samplenet.pth | ||
adapter: classification | ||
batch: 1 | ||
python_path: MODELS_DIR/pytorch_model | ||
|
||
datasets: | ||
- name: sample_dataset | ||
data_source: sample_dataset/test | ||
annotation_conversion: | ||
converter: cifar | ||
data_batch_file: cifar-10-batches-py/test_batch | ||
convert_images: True | ||
converted_images_dir: sample_dataset/test | ||
num_classes: 10 | ||
|
||
preprocessing: | ||
- type: resize | ||
size: 32 | ||
- type: bgr_to_rgb | ||
- type: normalization | ||
mean: (125.307, 122.961, 113.8575) | ||
std: (51.5865, 50.847, 51.255) | ||
|
||
metrics: | ||
- type: accuracy | ||
top_k: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.