-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made meter reader fit the kit template (#163)
* Pull all large files * Added required packages * Refactored code for CI * Added simple python group for CI * Update sanity-check-kits.yml * Update sanity-check-kits.yml * Fixed python group
- Loading branch information
1 parent
e4d53ac
commit bbf9099
Showing
11 changed files
with
70 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.onnx filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
from analog.paddle import analog_paddle | ||
from analog.yolo import analog_yolo | ||
from analog.paddle import AnalogPaddle | ||
from analog.yolo import AnalogYolo | ||
import argparse | ||
import cv2 | ||
import os | ||
import json | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(add_help=False) | ||
parser.add_argument('-h', '--help', action='help', help='Show this help message and exit.') | ||
parser.add_argument('-i', '--input', required=True, type=str, | ||
help='Required. Path to an image file.') | ||
parser.add_argument('-c', '--config', required=True, type=str, | ||
help='Required. config file path') | ||
parser.add_argument('-t', '--task', required=True, default='analog', type=str, | ||
help='Required. mode of meter reader, digital or analog') | ||
args = parser.parse_args() | ||
|
||
output_dir = os.path.abspath(os.path.dirname(args.input)) | ||
with open(args.config) as f: | ||
|
||
def main(img_path: str, config_file: str): | ||
output_dir = os.path.abspath(os.path.dirname(img_path)) | ||
with open(config_file) as f: | ||
config = json.load(f) | ||
if len(config["model_config"]["detector"]["model_shape"]) == 1: | ||
meter_reader = analog_yolo(config, output_dir) | ||
meter_reader = AnalogYolo(config, output_dir) | ||
else: | ||
meter_reader = analog_paddle(config, output_dir) | ||
image = cv2.imread(args.input) | ||
meter_reader = AnalogPaddle(config, output_dir) | ||
image = cv2.imread(img_path) | ||
det_resutls = meter_reader.detect(image) | ||
seg_resutls = meter_reader.segment(det_resutls) | ||
post_resutls = meter_reader.postprocess(seg_resutls) | ||
meter_reader.reading(post_resutls, image) | ||
print(f"result images saved to \"{output_dir}\".") | ||
print(f"result images saved to \"{output_dir}\".") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(add_help=False) | ||
parser.add_argument('-h', '--help', action='help', help='Show this help message and exit.') | ||
parser.add_argument('-i', '--input', default="data/test.jpg", type=str, | ||
help='Required. Path to an image file.') | ||
parser.add_argument('-c', '--config', default="config/yolov8.json", type=str, | ||
help='Required. config file path') | ||
parser.add_argument('-t', '--task', default='analog', type=str, | ||
help='Required. mode of meter reader, digital or analog') | ||
args = parser.parse_args() | ||
|
||
main(args.input, args.config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
openvino==2024.3.0 | ||
openvino==2024.6.0 | ||
numpy==1.26.4 | ||
opencv-python==4.9.0.80 | ||
requests==2.32.3 | ||
tqdm==4.67.1 |