Zaktualizuj 'Find_animal.py'

This commit is contained in:
Norbert Węgrzyn 2020-01-11 12:15:36 +00:00
parent ec6ee7f2fa
commit dac576cc44

View File

@ -80,7 +80,7 @@ def postprocess(boxes, masks):
# załaduj nazwy # załaduj nazwy
classesFile = "mscoco_labels.names"; classesFile = "labels.names";
classes = None classes = None
with open(classesFile, 'rt') as f: with open(classesFile, 'rt') as f:
classes = f.read().rstrip('\n').split('\n') classes = f.read().rstrip('\n').split('\n')
@ -114,14 +114,14 @@ if (args.image):
print("Input image file ", args.image, " doesn't exist") print("Input image file ", args.image, " doesn't exist")
sys.exit(1) sys.exit(1)
cap = cv.VideoCapture(args.image) cap = cv.VideoCapture(args.image)
outputFile = args.image[:-4]+'_mask_rcnn_out_py.jpg' outputFile = args.image[:-4]+'found_animal.jpg'
elif (args.video): elif (args.video):
# Otwiera plik video # Otwiera plik video
if not os.path.isfile(args.video): if not os.path.isfile(args.video):
print("Input video file ", args.video, " doesn't exist") print("Input video file ", args.video, " doesn't exist")
sys.exit(1) sys.exit(1)
cap = cv.VideoCapture(args.video) cap = cv.VideoCapture(args.video)
outputFile = args.video[:-4]+'_mask_rcnn_out_py.avi' outputFile = args.video[:-4]+'found_animal.avi'
# inicjalizacja zapisu video # inicjalizacja zapisu video
@ -134,8 +134,8 @@ while cv.waitKey(1) < 0:
# zamyka program, gdy skończy się film # zamyka program, gdy skończy się film
if not hasFrame: if not hasFrame:
print("Done processing !!!") print("Processing Done.")
print("Output file is stored as ", outputFile) print("Output file saved ad: ", outputFile)
cv.waitKey(3000) cv.waitKey(3000)
break break