conda create -n mrz_detection python=3.8
conda activate mrz_detection
pip install -r requirements.txt
-
Put the model
mrz_detection_best.pt
intomrz_detection_api/ai_models
directory. download model please click here -
Active virtual environment and open terminal into
mrz_detection_api
folder.
Run,
python3 -m test.test
input: ./data
output: ./logs
check the logs folder for detected mrz
import sys
sys.path.insert(0, './mrz_detection_api')
from mrz_detection_api.mrz_detect import load_model, inference
# def start_processing(model, image, output_dir="logs"):
img_file = './mrz_detection_api/data/1.jpg'
model_path_dir = './mrz_detection_api/ai_models/mrz_detection_best.pt'
image = cv2.imread(img_file)
model = load_model(model_path_dir)
box = inference(model, image)