|
|
|
|
|
|
|
|
from models.experimental import attempt_load |
|
|
from models.experimental import attempt_load |
|
|
from utils.datasets import LoadStreams, LoadImages |
|
|
from utils.datasets import LoadStreams, LoadImages |
|
|
from utils.general import check_img_size, check_requirements, check_imshow, non_max_suppression, apply_classifier, \ |
|
|
from utils.general import check_img_size, check_requirements, check_imshow, non_max_suppression, apply_classifier, \ |
|
|
scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path |
|
|
|
|
|
|
|
|
scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path, overlap_box_suppression |
|
|
from utils.plots import plot_one_box |
|
|
from utils.plots import plot_one_box |
|
|
from utils.torch_utils import select_device, load_classifier, time_synchronized |
|
|
from utils.torch_utils import select_device, load_classifier, time_synchronized |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Apply NMS |
|
|
# Apply NMS |
|
|
pred = non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=opt.agnostic_nms) |
|
|
pred = non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=opt.agnostic_nms) |
|
|
|
|
|
|
|
|
|
|
|
pred = overlap_box_suppression(pred, opt.ovlap_thres) |
|
|
|
|
|
|
|
|
t2 = time_synchronized() |
|
|
t2 = time_synchronized() |
|
|
|
|
|
|
|
|
# Apply Classifier |
|
|
# Apply Classifier |
|
|
|
|
|
|
|
|
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)') |
|
|
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)') |
|
|
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold') |
|
|
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold') |
|
|
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS') |
|
|
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS') |
|
|
|
|
|
parser.add_argument('--ovlap-thres', type=float, default=0.6, help='overlap threshold for OBS') |
|
|
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') |
|
|
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') |
|
|
parser.add_argument('--view-img', action='store_true', help='display results') |
|
|
parser.add_argument('--view-img', action='store_true', help='display results') |
|
|
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt') |
|
|
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt') |