Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom image Inference #91

Open
kdh-awraw1019 opened this issue Apr 14, 2022 · 3 comments
Open

Custom image Inference #91

kdh-awraw1019 opened this issue Apr 14, 2022 · 3 comments

Comments

@kdh-awraw1019
Copy link

I want to inference about a custom image.

this image is not in 'Prepare datasets' ex) ic17, ic15, ...

How can I inference a custom image?

How should I change it here? ▼▼

./config/pan_pp/pan_pp_r18_ic15_joint_train.py

data = dict(
batch_size=16,
train=dict(
type='PAN_PP_JointTrain',
split='train',
is_transform=True,
img_size=736,
short_size=736,
kernel_scale=0.5,
read_type='pil',
with_rec=True
),
test=dict(
type='PAN_PP_IC15',
split='test',
short_size=720,
read_type='pil',
with_rec=True
)
)

@EMRAN-SALEH-CORSEARCH
Copy link

Yeah, Same here. I want ro do inference of PAN++ on custom image. I do not see that in the repo.

@kdh-awraw1019
Copy link
Author

Yeah, Same here. I want ro do inference of PAN++ on custom image. I do not see that in the repo.

I did modified some codes and inference with my cunstom data.

  1. pan_pp.pytorch/dataset/pan_pp/pan_pp_joint_train.py

import math
import random
import string

import cv2
import mmcv
import numpy as np
import Polygon as plg
import pyclipper
import scipy.io as scio
import torch
import torchvision.transforms as transforms
from PIL import Image
from torch.utils import data

from .coco_text import COCO_Text

EPS = 1e-6
synth_root_dir = './data/SynthText/'
synth_train_data_dir = synth_root_dir
synth_train_gt_path = synth_root_dir + 'gt.mat'

ic17_root_dir = './data/ICDAR2017MLT/'
ic17_train_data_dir = ic17_root_dir + 'ch8_training_images/'
ic17_train_gt_dir = ic17_root_dir +
'ch8_training_localization_transcription_gt_v2/'

ct_root_dir = './data/COCO-Text/'
ct_train_data_dir = ct_root_dir + 'train2014/'
ct_train_gt_path = ct_root_dir + 'COCO_Text.json'

'''
ic15_root_dir = './data/ICDAR2015/Challenge4/'
ic15_train_data_dir = ic15_root_dir + 'ch4_training_images/'
ic15_train_gt_dir = ic15_root_dir +
'ch4_training_localization_transcription_gt/'
'''
############ modified #######
ic15_root_dir = your dataset path location ##
ic15_test_data_dir = ic15_root_dir + 'imgs/'
ic15_test_gt_dir = ic15_root_dir + 'gts/'

##################################

  1. pan_pp.pytorch/configs/pan_pp/pan_pp_r18_ic15_joint_train.py
    data = dict(
    batch_size=1,
    train=dict(
    type='PAN_PP_JointTrain',
    split='train',
    is_transform=True,
    img_size=736,# 736,
    short_size=736,# 736,
    kernel_scale=0.5,
    read_type='pil',
    with_rec=True
    ),
    test=dict(
    type='PAN_PP_IC15', ## my custom dataset's format is ic15
    split='test',
    short_size=96,# default : 720,
    read_type='pil',
    with_rec=True
    )
    )

@Devin521314
Copy link

Devin521314 commented Sep 1, 2022

How to predict a new image using the training weight?it doesn't work below.

python test.py config/pan/pan_r18_ic15.py checkpoints/pan_r18_ic15/checkpoint.pth.tar
cd eval/
./eval_ic15.sh

please inform me with qushanghui@niii.com or wechat SanQian-2012,thanks you so much.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants