Skip to content

Commit 383ae84

Browse files
Updating the working version of the code
1 parent d7e1b7e commit 383ae84

File tree

9,545 files changed

+2156710
-2074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

9,545 files changed

+2156710
-2074
lines changed

capture.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"""Script to capture images from object detection"""
2+
3+
import argparse
4+
from utils import video
5+
from detection import deeplearning
6+
7+
def parse_argument():
8+
"""Parse arguments for command line"""
9+
parser = argparse.ArgumentParser(
10+
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
11+
parser.add_argument(
12+
'--multipleObject',
13+
help='Whether to detect single or multiple types of objects.',
14+
required=False,
15+
default=False)
16+
parser.add_argument(
17+
'--trueClass',
18+
help='Name of the object class to be detected if it is a single type.',
19+
required=False,
20+
type=str,
21+
default='yellow_duck')
22+
parser.add_argument(
23+
'--collectAll',
24+
help='Whether to collect all images or only the True Positive one.',
25+
required=False,
26+
default=False)
27+
parser.add_argument(
28+
'--model',
29+
help='Path of the object detection model.',
30+
required=False,
31+
default='./model/frogducky2.tflite')
32+
parser.add_argument(
33+
'--frameWidth',
34+
help='Width of frame to capture from camera.',
35+
required=False,
36+
type=int,
37+
default=640)
38+
parser.add_argument(
39+
'--frameHeight',
40+
help='Height of frame to capture from camera.',
41+
required=False,
42+
type=int,
43+
default=480)
44+
parser.add_argument(
45+
'--numThreads',
46+
help='Number of CPU threads to run the model.',
47+
required=False,
48+
type=int,
49+
default=4)
50+
parser.add_argument(
51+
'--enableEdgeTPU',
52+
help='Whether to run the model on EdgeTPU.',
53+
action='store_true',
54+
required=False,
55+
default=False)
56+
parser.add_argument(
57+
'--videoFilename',
58+
help='Name of the output video file with .mp4 extension',
59+
required=False,
60+
default='Deteksi_Objek.mp4')
61+
return parser.parse_args()
62+
63+
def main():
64+
"""Main function to run detection"""
65+
args = parse_argument()
66+
detector = deeplearning.ConveyorDetector(bool(args.multipleObject), args.model,
67+
args.frameWidth, args.frameHeight,
68+
int(args.numThreads),bool(args.enableEdgeTPU))
69+
detector.capture(bool(args.collectAll), str(args.videoFilename), str(args.trueClass))
70+
video.move_video(str(args.videoFilename))
71+
72+
73+
if __name__ == '__main__':
74+
main()

code/constant.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

code/detect_and_capture.py

Lines changed: 0 additions & 313 deletions
This file was deleted.

0 commit comments

Comments
 (0)