diff --git a/demo/csrc/cpp/classifier.cxx b/demo/csrc/cpp/classifier.cxx index 79094c6d89..3f55d9524d 100644 --- a/demo/csrc/cpp/classifier.cxx +++ b/demo/csrc/cpp/classifier.cxx @@ -28,8 +28,10 @@ int main(int argc, char* argv[]) { // construct a classifier instance mmdeploy::Classifier classifier(mmdeploy::Model{ARGS_model}, context); - - + // warmup + for (int i = 0; i < 20; ++i) { + classifier.Apply(img); + } // apply the classifier; the result is an array-like class holding references to // `mmdeploy_classification_t`, will be released automatically on destruction diff --git a/demo/csrc/cpp/detector.cxx b/demo/csrc/cpp/detector.cxx index f6e77c9689..b91ea1b280 100644 --- a/demo/csrc/cpp/detector.cxx +++ b/demo/csrc/cpp/detector.cxx @@ -29,6 +29,11 @@ int main(int argc, char* argv[]) { // construct a detector instance mmdeploy::Detector detector(mmdeploy::Model{ARGS_model}, context); + // warmup + for (int i = 0; i < 20; ++i) { + detector.Apply(img); + } + // apply the detector, the result is an array-like class holding references to // `mmdeploy_detection_t`, will be released automatically on destruction mmdeploy::Detector::Result dets = detector.Apply(img); diff --git a/demo/csrc/cpp/pose_detector.cxx b/demo/csrc/cpp/pose_detector.cxx index 577c2b6383..025afdd794 100644 --- a/demo/csrc/cpp/pose_detector.cxx +++ b/demo/csrc/cpp/pose_detector.cxx @@ -27,6 +27,12 @@ int main(int argc, char *argv[]) { context.Add(profiler); PoseDetector detector{Model(model_path), context}; + + // warmup + for (int i = 0; i < 20; ++i) { + detector.Apply(img); + } + auto res = detector.Apply(img); for (int i = 0; i < res[0].length; i++) { diff --git a/demo/csrc/cpp/restorer.cxx b/demo/csrc/cpp/restorer.cxx index 639b29fd44..0b788a2514 100644 --- a/demo/csrc/cpp/restorer.cxx +++ b/demo/csrc/cpp/restorer.cxx @@ -30,6 +30,11 @@ int main(int argc, char* argv[]) { // construct a restorer instance mmdeploy::Restorer restorer{mmdeploy::Model{ARGS_model}, context}; + // warmup + for (int i = 0; i < 20; ++i) { + restorer.Apply(img); + } + // apply restorer to the image mmdeploy::Restorer::Result result = restorer.Apply(img); diff --git a/demo/csrc/cpp/rotated_detector.cxx b/demo/csrc/cpp/rotated_detector.cxx index 24bf1f99af..6c5b9f1d37 100644 --- a/demo/csrc/cpp/rotated_detector.cxx +++ b/demo/csrc/cpp/rotated_detector.cxx @@ -30,6 +30,11 @@ int main(int argc, char* argv[]) { // construct a detector instance mmdeploy::RotatedDetector detector(mmdeploy::Model{ARGS_model}, context); + // warmup + for (int i = 0; i < 20; ++i) { + detector.Apply(img); + } + // apply the detector, the result is an array-like class holding references to // `mmdeploy_rotated_detection_t`, will be released automatically on destruction mmdeploy::RotatedDetector::Result dets = detector.Apply(img); diff --git a/demo/csrc/cpp/segmentor.cxx b/demo/csrc/cpp/segmentor.cxx index a2aca27bca..c12f8f4153 100644 --- a/demo/csrc/cpp/segmentor.cxx +++ b/demo/csrc/cpp/segmentor.cxx @@ -33,6 +33,11 @@ int main(int argc, char* argv[]) { context.Add(profiler); mmdeploy::Segmentor segmentor{mmdeploy::Model{ARGS_model}, context}; + // warmup + for (int i = 0; i < 20; ++i) { + segmentor.Apply(img); + } + // apply the detector, the result is an array-like class holding a reference to // `mmdeploy_segmentation_t`, will be released automatically on destruction mmdeploy::Segmentor::Result seg = segmentor.Apply(img); diff --git a/tools/scripts/build_ubuntu_x64_ncnn.py b/tools/scripts/build_ubuntu_x64_ncnn.py index 015381ebac..2f7ab48cac 100644 --- a/tools/scripts/build_ubuntu_x64_ncnn.py +++ b/tools/scripts/build_ubuntu_x64_ncnn.py @@ -60,7 +60,7 @@ def install_pyncnn(dep_dir): # git clone if not os.path.exists('ncnn'): os.system( - 'git clone --depth 1 --branch 20230517 https://github.com/tencent/ncnn && cd ncnn' # noqa: E501 + 'git clone --depth 1 --branch 20230816 https://github.com/tencent/ncnn && cd ncnn' # noqa: E501 ) ncnn_dir = os.path.join(dep_dir, 'ncnn') @@ -90,7 +90,7 @@ def install_pyncnn(dep_dir): # install os.chdir(ncnn_dir) - os.system('cd python && python -m pip install -e .') + os.system('cd python && python -m pip install -e . --user --no-cache-dir') ncnn_cmake_dir = os.path.join(ncnn_dir, 'build', 'install', 'lib', 'cmake', 'ncnn') assert (os.path.exists(ncnn_cmake_dir)) @@ -130,7 +130,7 @@ def install_mmdeploy(work_dir, dep_dir, ncnn_cmake_dir): os.system(cmd) os.system('cd build && make -j {} && make install'.format(g_jobs)) - os.system('python3 -m pip install -v -e .') + os.system('python3 -m pip install -v -e . --user --no-cache-dir') os.system(""" echo 'export PATH={}:$PATH' >> ~/mmdeploy.env """.format( os.path.join(work_dir, 'mmdeploy', 'backend', 'ncnn'))) try: