add some new python demos
This commit is contained in:
parent
d631c4d009
commit
c598b3aef4
23 changed files with 2174 additions and 11 deletions
|
|
@ -107,7 +107,7 @@ def preprocess(img_path, input_size=(320, 320)):
|
|||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="RetinaFace AMLNNLite Demo")
|
||||
parser.add_argument('--board-work-path', type=str, default='/data/nn')
|
||||
parser.add_argument('--board-work-path', type=str, default='/data/local/tmp')
|
||||
parser.add_argument('--model-path', required=True, help='Path to .adla model')
|
||||
parser.add_argument('--image-dir', required=True, help='Directory of test images')
|
||||
parser.add_argument('--run-cycles', type=int, default=1, help='Inference cycles')
|
||||
|
|
@ -122,13 +122,18 @@ def main():
|
|||
amlnn.init()
|
||||
|
||||
priors = PriorBox((320, 320)).forward()
|
||||
image_files = sorted(glob.glob(os.path.join(args.image_dir, "*.[jp][pn][g]")))
|
||||
image_files = []
|
||||
for ext in ["*.jpg", "*.jpeg", "*.png", "*.bmp"]:
|
||||
image_files.extend(glob.glob(os.path.join(args.image_dir, ext)))
|
||||
image_files.extend(glob.glob(os.path.join(args.image_dir, ext.upper())))
|
||||
image_files.sort()
|
||||
|
||||
if not image_files:
|
||||
print(f"No images found in {args.image_dir}")
|
||||
amlnn.uninit(); return
|
||||
|
||||
res_dir = "retinaface_result"
|
||||
model_stem = Path(args.model_path).stem
|
||||
res_dir = f"{model_stem}_result"
|
||||
os.makedirs(res_dir, exist_ok=True)
|
||||
|
||||
for idx, img_path in enumerate(image_files, start=1):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue