diff --git a/ppocr/utils/gen_label.py b/ppocr/utils/gen_label.py index fb78bd38bcfc1a59cac48a28bbb655ecb83bcb3f..56d75544dbee596a87343c90320b0ea3178e6b28 100644 --- a/ppocr/utils/gen_label.py +++ b/ppocr/utils/gen_label.py @@ -29,7 +29,7 @@ def gen_rec_label(input_path, out_label): def gen_det_label(root_path, input_dir, out_label): with open(out_label, 'w') as out_file: for label_file in os.listdir(input_dir): - img_path = root_path + label_file[3:-4] + ".jpg" + img_path = os.path.join(root_path, label_file[3:-4] + ".jpg") label = [] with open( os.path.join(input_dir, label_file), 'r', diff --git a/tools/infer/utility.py b/tools/infer/utility.py index 207b2e5f35dec8934fd2875748e8bcc21a94b7bf..83451e9496393cc04b86a9766f747f959a921ad7 100644 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -42,6 +42,7 @@ def init_args(): parser.add_argument("--min_subgraph_size", type=int, default=15) parser.add_argument("--precision", type=str, default="fp32") parser.add_argument("--gpu_mem", type=int, default=500) + parser.add_argument("--gpu_id", type=int, default=0) # params for text detector parser.add_argument("--image_dir", type=str) @@ -219,7 +220,7 @@ def create_predictor(args, mode, logger): logger.warning( "GPU is not found in current device by nvidia-smi. Please check your device or ignore it if run on jetson." ) - config.enable_use_gpu(args.gpu_mem, 0) + config.enable_use_gpu(args.gpu_mem, args.gpu_id) if args.use_tensorrt: config.enable_tensorrt_engine( workspace_size=1 << 30,