Skip to content

Commit

Permalink
support set gpu_id when inference (PaddlePaddle#8926)
Browse files Browse the repository at this point in the history
* support min_area_rect crop

* add check_install

* fix requirement.txt

* fix check_install

* add lanms-neo for drrg

* fix

* fix doc

* fix

* support set gpu_id when inference

* fix PaddlePaddle#8855

* fix PaddlePaddle#8855
  • Loading branch information
LDOUBLEV committed Jan 30, 2023
1 parent 9059f74 commit 3629d5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ppocr/utils/gen_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion tools/infer/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3629d5a

Please sign in to comment.