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

How to output the text in the picture to a text file with your project like the picture on homepage #24

Open
Sesefad0u opened this issue Oct 2, 2018 · 19 comments
Labels
bug Something isn't working

Comments

@Sesefad0u
Copy link

Thanks for your share,it's good . But there are too many file for a new, and i just want that use it like this :input a picture with some text in it and output the text into a text file via the trained model in your project. Which py file should i use and what should i do ? Thanks !

@yuantailing
Copy link
Owner

I think you should see tutorial (Part 3: detection baseline).

After you run cd ../detection && python3 merge_results.py (and have run all code above it), you will get detection results in detection/products/detections.jsonl.

@kdzmwl
Copy link

kdzmwl commented Oct 3, 2018

If I want to use the existing models, are all the images shared(image-test, image-trainval) necessary?
If not, should I begin from ### Download trained models?
New comer here, thx.

@yuantailing
Copy link
Owner

yuantailing commented Oct 3, 2018

I think you could download only testset but not download trainval. Annotation files must be downloaded.
Some files are generated in training steps. If you don't download trainval images, some scripts may fail. If it fails in some images not found, you can fill them with any image of shape 2048x2048x3.

@kdzmwl
Copy link

kdzmwl commented Oct 3, 2018

I think you could download only testset but not download trainval. Annotation files must be downloaded.
Some files are generated in training steps. If you don't download trainval images, some scripts may fail. If it fails in some images not found, you can fill them with any image of shape 2048x2048x3.

Then how about using our own images? Should still download the image-test or just turn ours into 2048x2048x3(and put them into the correct place)?

@yuantailing
Copy link
Owner

@kdzmwl
I think it can be done by changing detection/prepare_test_data.py.

@Sesefad0u
Copy link
Author

When I run prepare_test_data.py ,There are no text come out in detection/products/test/ as you say that this step will output detection/products/test/*.{jpg,txt} . And when I run eval.py , It's normal . But when merge_results.py run , it tells me that there are no file called like "chinese.0.txt" and so on . And I found that the file in products/results is called"chinese.00.txt,chinese.010.txt,...chinese.10.txt, chinese.100.txt....." . What's wrong with it and what should I do? Thanks!

@yuantailing
Copy link
Owner

yuantailing commented Oct 6, 2018

  1. output means these files will be created, not output to stdout.
  2. For the filname issue, did you edited my code anywhere? Please roll back. Or you can edit merge_results.py to read your filename.

@Sesefad0u
Copy link
Author

We didn't change your code, just put a picture of a zip file in image/test (a total of seven zip) and changed info.json. The code eval.py runs without error, but runs merge_results.py When he told us that there was no chinese.0.txt, we looked at products/result and found that only Chinese.00.txt was associated with this. And in the end we want to throw our own pictures and run out of the results, then shouldn't this be the case?

@Sesefad0u
Copy link
Author

I have 4 GPU on my server. What should I change in eval.py can make it run with 4GPU ? (It run at only one GPU now),Thanks!

@yuantailing
Copy link
Owner

yuantailing commented Oct 6, 2018

We decide which GPU to use in

darknet_results_out = darknet_tools.append_before_ext(settings.DARKNET_RESULTS_OUT, '.{}'.format(split_id))
. Accroding to detection/settings.py, TEST_NUM_GPU = 2, it will use 2 GPUs.
Why your code use only 1 GPU? Did git diff indicates that there is no change?

@yuantailing
Copy link
Owner

yuantailing commented Oct 6, 2018

And output filename is determined in https://github.com/yuantailing/ctw-baseline/blob/master/detection/eval.py#L30 , the number is formatted to string by '.{}'.format(split_id), why your .txt has a leading "0"?

@Sesefad0u
Copy link
Author

But I print it and it just output" chinese.0.data", and it's correct . I download a new from your github and it's output is chinese.00.txt , too.

@Sesefad0u
Copy link
Author

And we found there are no cate_id in chinese.xx.txt,what should i do ?Thanks

@yuantailing yuantailing added the bug Something isn't working label Oct 6, 2018
@yuantailing
Copy link
Owner

yuantailing commented Oct 6, 2018

According to yuantailing/darknet@fe0a91a#diff-265d49678e2dbc64f1aeb120e056f2bfR176 , cate_id should be the first number in each line.

Did you clone the right version of darknet? It is defined in https://github.com/yuantailing/ctw-baseline/blob/master/.gitmodules (clone from yuantailing/darknet and switch to branch ctw).

@Sesefad0u
Copy link
Author

The Eorrr is in

file_path, cate_id, x, y, w, h, prob = line.split()
(file_path, cate_id, x, y, w, h, prob = line.split()) and the text is 3045513_2_1_1 0.012630 95.435127 23.111725 150.123352 120.032806 in chinese.xx.txt

@yuantailing
Copy link
Owner

It seems you are using a wrong version of darknet.

@Sesefad0u
Copy link
Author

I use the darknet in your github ...

@yuantailing
Copy link
Owner

yuantailing commented Oct 6, 2018

But, why no cate_id ... Could you run to this line?

https://github.com/yuantailing/darknet/blob/ctw/examples/detector.c#L176

(commit id is 801409731a46b072b8ee11f6f2acfa29cb16f165: https://github.com/yuantailing/darknet/blob/801409731a46b072b8ee11f6f2acfa29cb16f165/examples/detector.c#L176 )

@Sesefad0u
Copy link
Author

It can't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants