Skip to content

Commit e5a09bf

Browse files
Merge pull request #203 from luxonis/model_downloader_main
Add model downloader
2 parents c0d7f75 + 482d781 commit e5a09bf

24 files changed

+1306
-107
lines changed

examples/08_rgb_mobilenet.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
parser.add_argument('-s', '--sync', action="store_true", help="Sync RGB output with NN output", default=False)
1414
args = parser.parse_args()
1515

16+
if not Path(nnPathDefault).exists():
17+
import sys
18+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
19+
1620
# Start defining a pipeline
1721
pipeline = dai.Pipeline()
1822

examples/09_mono_mobilenet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
if len(sys.argv) > 1:
1212
nnPath = sys.argv[1]
1313

14+
if not Path(nnPath).exists():
15+
import sys
16+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
1417

1518
# Start defining a pipeline
1619
pipeline = dai.Pipeline()

examples/10_mono_depth_mobilenetssd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
if len(sys.argv) > 1:
1212
nnPath = sys.argv[1]
1313

14+
if not Path(nnPath).exists():
15+
import sys
16+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
1417

1518
# Start defining a pipeline
1619
pipeline = dai.Pipeline()

examples/11_rgb_encoding_mono_mobilenet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
if len(sys.argv) > 1:
1212
nnPath = sys.argv[1]
1313

14+
if not Path(nnPath).exists():
15+
import sys
16+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
1417

1518
pipeline = dai.Pipeline()
1619

examples/12_rgb_encoding_mono_mobilenet_depth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
if len(sys.argv) > 1:
1212
nnPath = sys.argv[1]
1313

14+
if not Path(nnPath).exists():
15+
import sys
16+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
1417

1518
pipeline = dai.Pipeline()
1619

examples/15_rgb_mobilenet_4k.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
if len(sys.argv) > 1:
1212
nnPath = sys.argv[1]
1313

14+
if not Path(nnPath).exists():
15+
import sys
16+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
17+
1418
# Start defining a pipeline
1519
pipeline = dai.Pipeline()
1620

examples/17_video_mobilenet.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88
from time import monotonic
99

1010
# Get argument first
11-
nnPath = str((Path(__file__).parent / Path('models/mobilenet-ssd_openvino_2021.2_8shave.blob')).resolve().absolute())
12-
videoPath = str(Path("./construction_vest.mp4").resolve().absolute())
11+
parentDir = Path(__file__).parent
12+
nnPath = str((parentDir / Path('models/mobilenet-ssd_openvino_2021.2_8shave.blob')).resolve().absolute())
13+
videoPath = str((parentDir / Path('models/construction_vest.mp4')).resolve().absolute())
1314
if len(sys.argv) > 2:
1415
nnPath = sys.argv[1]
1516
videoPath = sys.argv[2]
1617

18+
if not Path(nnPath).exists() or not Path(videoPath).exists():
19+
import sys
20+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
21+
1722
# Start defining a pipeline
1823
pipeline = dai.Pipeline()
1924

examples/18_rgb_encoding_mobilenet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
if len(sys.argv) > 1:
1212
nnPath = sys.argv[1]
1313

14+
if not Path(nnPath).exists():
15+
import sys
16+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
1417

1518
pipeline = dai.Pipeline()
1619

examples/22_1_tiny_yolo_v3_device_side_decoding.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
if len(sys.argv) > 1:
3939
nnPath = sys.argv[1]
4040

41+
if not Path(nnPath).exists():
42+
import sys
43+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
44+
4145
# Start defining a pipeline
4246
pipeline = dai.Pipeline()
4347

examples/22_2_tiny_yolo_v4_device_side_decoding.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
if len(sys.argv) > 1:
3838
nnPath = sys.argv[1]
3939

40+
if not Path(nnPath).exists():
41+
import sys
42+
raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"')
43+
4044
# Start defining a pipeline
4145
pipeline = dai.Pipeline()
4246

0 commit comments

Comments
 (0)