output_json = input_json image_filenames = crablip.get_person_face_image_filenames_from_json(input_json) if image_filenames: with file(outfn, "w") as outfile: cnn_classify.run( image_filenames, args.model_path, args.model_snapshot, model_deploy=args.model_deploy, labels_name=args.model_labels, mean_pixel_name=args.mean_pixel_name, gray_range=args.gray_range, channel_swap=args.channel_swap, batch_size=args.batch_size, gpu_id=args.gpu_id, verbose=args.verbose, json=args.json, outfile=outfile, ) with file(outfn, "r") as fp: gender_classification = json.load(fp) output_json = crablip.generate_output_json_face( input_json, gender_classification, probability_threshold, classifier_key, tag_name_translation ) json.dump(output_json, args.workflow_out, indent=4)
outfn = "/tmp/age_classification.json" input_json = json.load(args.json_input_file) output_json = input_json image_filenames = crablip.get_person_face_image_filenames_from_json(input_json) if image_filenames: with file(outfn, "w") as outfile: cnn_classify.run(image_filenames, args.model_path, args.model_snapshot, model_deploy=args.model_deploy, labels_name=args.model_labels, mean_pixel_name=args.mean_pixel_name, gray_range=args.gray_range, channel_swap=args.channel_swap, batch_size=args.batch_size, gpu_id=args.gpu_id, verbose=args.verbose, json=args.json, outfile=outfile) with file(outfn, "r") as fp: classification = json.load(fp) output_json = crablip.generate_output_json_face(input_json, classification, probability_threshold, classifier_key) json.dump(output_json, args.workflow_out, indent=4)