-
-
Notifications
You must be signed in to change notification settings - Fork 55.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts for downloading models in DNN samples #18591
Conversation
@alalek Can you please review these changes? Please, let me know, if there is something else needed for this task. |
@vpisarev please take a look. |
@sl-sergei, thank you!
Approximate usage:
|
This means that this functionality should be contributed into Python package with OpenCV itself (somewhere here)
There are several variants which are not secure (due to be globally writable locations, like /tmp). |
Okay, I will do it |
@sl-sergei, thank you! I still do not see how this functionality can be used from another Python script, as in the sample that I put above. Can you, please, modify at least one Python sample to download some data automatically? |
@sl-sergei, looks good to me! 👍 |
@alalek Could we merge it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see changes in current samples.
Is there some "single-click" sample? Which can download all necessary data without passing of extra parameters?
samples/dnn/models.yml
Outdated
################################################################################ | ||
# Object detection models. | ||
################################################################################ | ||
|
||
# OpenCV's face detection network | ||
opencv_fd: | ||
load_info: | ||
url: "https://github.com/opencv/opencv_3rdparty/raw/dnn_samples_face_detector_20170830/res10_300x300_ssd_iter_140000.caffemodel" | ||
sha: "15aa726b4d46d9f023526d85537db81cbc8dd566" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let use sha1
entry name (because there are several SHA implementations or user may want to pass md5
instead).
temp_env = os.environ.get("TMPDIR", None) | ||
if temp_env is None or not os.path.isdir(temp_env): | ||
temp_dir = Path("/tmp") | ||
print("Using world accessible cache directory. This may be not secure: ", temp_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should wrap and reuse C++ implementation instead of adding duplicated logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets rollback changes and add "TODO" here until we have resolved issues in #18931
|
@vpisarev @asmorkalov @sl-sergei Please provide feedback on comments above. |
@alalek I have already fixed naming for SHA1 key locally and plan to reuse getCacheDirectory, just in the middle of progress |
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samples/dnn/download_models.py
Probably its name is very specific. We may want to download other files (like annotations, datasets) too.
Also we can keep this "as is" and then proxy into cv.downloader
from package when it will be available.
samples/dnn/README.md
Outdated
|
||
By running the following commands, you will get **MobileNetSSD_deploy.caffemodel** file: | ||
```bash | ||
export OPENCV_SAVE_DIR=save_dir_2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets introduce more specific name here.
It is unclear what is going to be saved here. May be test results?
Something like:
OPENCV_DOWNLOAD_DATA_PATH
OPENCV_DOWNLOAD_CACHE_DATA_PATH
P.S. _DATA_PATH
is aligned with OPENCV_TEST_DATA_PATH
temp_env = os.environ.get("TMPDIR", None) | ||
if temp_env is None or not os.path.isdir(temp_env): | ||
temp_dir = Path("/tmp") | ||
print("Using world accessible cache directory. This may be not secure: ", temp_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets rollback changes and add "TODO" here until we have resolved issues in #18931
…specific env variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 👍
Relates: #12186