-
Notifications
You must be signed in to change notification settings - Fork 8
/
count_objects.py
24 lines (22 loc) · 943 Bytes
/
count_objects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import torch
import argparse
import torch.multiprocessing as mp
from caller import caller
from pathlib import Path
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Get the count of detected objects.")
parser.add_argument("-f", "--folder",
help="folder having the images", type=Path,
required=True)
parser.add_argument("-o", "--output",
help="path of the output file", type=Path,
required=True, dest="output")
parser.add_argument("-d", "--detectors",
help="number of detector processes", type=int, default=2)
parser.add_argument("-q", "--qsize",
help="size of the image queue", type=int, default=8)
args = parser.parse_args()
mp.set_start_method("spawn")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
caller(device, args.folder, args.output, args.detectors, args.qsize)