Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

데모 이미지 입력 문의 #27

Open
hyuk199 opened this issue Jun 8, 2021 · 0 comments
Open

데모 이미지 입력 문의 #27

hyuk199 opened this issue Jun 8, 2021 · 0 comments

Comments

@hyuk199
Copy link

hyuk199 commented Jun 8, 2021

웹캠에 연결해 글자부분을 잘라 해당 모델로 넘겨주어 작동하게 하려합니다.
demo.py 코드를 수정하며 작업중인데

demo_data = RawDataset(root=opt.image_folder, opt=opt)  # use RawDataset
demo_loader = torch.utils.data.DataLoader(
    demo_data, batch_size=opt.batch_size, shuffle=False, num_workers=int(opt.workers), 
    collate_fn=AlignCollate_demo, pin_memory=True)

해당 부분에서 에러가 납니다.
현재 이미지 폴더가 아니라 하나의 이미지를 받는것이라demo_data를 지우고

demo_loader = torch.utils.data.DataLoader(
        (img,), batch_size=opt.batch_size,
        shuffle=False,num_workers=4,
        collate_fn=AlignCollate_demo, pin_memory=True)

수정했습니다.

 # predict
ocr_model.eval()
for image_tensors, image_path_list in demo_loader: #<---
        batch_size = image_tensors.size(0)
        with torch.no_grad():

표시 부분에서 아래와 같이 에러가 납니다.

ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/user/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/user/.local/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "./ocr_kor/deep-text-recognition-benchmark/dataset.py", line 273, in __call__
    images, labels = zip(*batch)
ValueError: too many values to unpack (expected 2)

이미지 폴더가 아닌 하나의 이미지를 받아 처리하는 방법이 있을까요?

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

No branches or pull requests

1 participant