Skip to content

Commit 86bc519

Browse files
Erol444SzabolcsGergely
authored andcommitted
added notification when required file/s doesn't exist and prompt user to run install_requirements.py. Also changed the path to the video in demo 17
1 parent 62b82c8 commit 86bc519

14 files changed

+40
-2
lines changed

examples/08_rgb_mobilenet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
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+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
18+
1619
# Start defining a pipeline
1720
pipeline = dai.Pipeline()
1821

examples/09_mono_mobilenet.py

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

14+
if not Path(nnPath).exists():
15+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
1416

1517
# Start defining a pipeline
1618
pipeline = dai.Pipeline()

examples/10_mono_depth_mobilenetssd.py

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

14+
if not Path(nnPath).exists():
15+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
1416

1517
# Start defining a pipeline
1618
pipeline = dai.Pipeline()

examples/11_rgb_encoding_mono_mobilenet.py

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

14+
if not Path(nnPath).exists():
15+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
1416

1517
pipeline = dai.Pipeline()
1618

examples/12_rgb_encoding_mono_mobilenet_depth.py

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

14+
if not Path(nnPath).exists():
15+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
1416

1517
pipeline = dai.Pipeline()
1618

examples/15_rgb_mobilenet_4k.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+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
16+
1417
# Start defining a pipeline
1518
pipeline = dai.Pipeline()
1619

examples/17_video_mobilenet.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
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+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
20+
1721
# Start defining a pipeline
1822
pipeline = dai.Pipeline()
1923

examples/18_rgb_encoding_mobilenet.py

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

14+
if not Path(nnPath).exists():
15+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
1416

1517
pipeline = dai.Pipeline()
1618

examples/22_1_tiny_yolo_v3_device_side_decoding.py

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

41+
if not Path(nnPath).exists():
42+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
43+
4144
# Start defining a pipeline
4245
pipeline = dai.Pipeline()
4346

examples/22_2_tiny_yolo_v4_device_side_decoding.py

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

40+
if not Path(nnPath).exists():
41+
raise RuntimeError("Required file/s not found, please run 'python3 install_requirements.py'")
42+
4043
# Start defining a pipeline
4144
pipeline = dai.Pipeline()
4245

0 commit comments

Comments
 (0)