Sometimes we need to use curl/wget to download files from Google Drive
from scripts. In terms of small file, we don't have any issues, but on the other hand, with a big file(especially download pre-trained model) needs to download the file manually which is very annoyed.
In this my last post in 2019, I'll show you how to avoid downloading files manually.
Small file
https://drive.google.com/file/d/0B-0p-MTxJBSCU2lwaGNUZ3VYSG8/view?usp=sharing
This is my Processing sketch and the size of the file is 2MB.
In the link, 0B-0p-MTxJBSCU2lwaGNUZ3VYSG8
is fileId
$ wget "https://drive.google.com/uc?export=download&id=<fileId>" -O <fileName>
$ wget "https://drive.google.com/uc?export=download&id=0B-0p-MTxJBSCU2lwaGNUZ3VYSG8" -O myProcessing_sketch.mp4
Big file
In terms of a big file, the way to download is a little bit complicated since Google Drive tries to scan the file to make things secure.
In this case, we will try to download M2Det's pre-trained model.
M2Det
Codebase for AAAI2019 "M2Det: A Single-Shot Object Detector based on Multi-Level Feature Pyramid Network" [Paper link]
Author: Qijie Zhao. Date: 19/01/2019
Contents
Introduction
Motivation:
Beyond scale variation, appearance-complexity variation should be considered too for the object detection task, due to that the object instances with similar size can be quite different.
To solve this, we extend multi-scale detection fashions with a new dimension: multi-level. Deeper level learns features for objects with more appearance-complexity variation(e.g., pedestrian), while shallower level learns features for more simplistic objects(e.g., traffic light).
1, We propose Multi Level FPN:
2, Based on MLFPN, we propose a single-shot object detector: M2Det, which represents the Multi-Level Multi-Scale Detector.
Methodology:
a. Construct the base feature:
We use the output of FFMv1(Feature Fusion Module v1) to construct the base feature. The size is fixed asβ¦
To download a big file, we will need 4 digits which are code
in a shell script. Then we also need fileId
and fileName
as well.
# https://drive.google.com/file/d/1NM1UDdZnwHwiNDxhcP-nndaWj24m-90L/view
fileId=1NM1UDdZnwHwiNDxhcP-nndaWj24m-90L
fileName=m2det512_vgg.pth
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=${fileId}" > /dev/null
code="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${code}&id=${fileId}" -o ${fileName}
Top comments (2)
Thanks pal, very useful information, go ahead.
thanks!