Reputation: 2698
I'm trying to reproduce results from this repository using docker.
I have completed the pull using
docker pull gasparjan/crnn_ocr:cpu
and run it using
docker run --rm -it -v /home:/data -p 8004:8000 gasparjan/crnn_ocr:cpu
To execute the following command:
python3 predict.py --G 0 --model_path %PATH_TO_MODEL% \
--image_path %PATH_TO_IMAGES% \
--validate --num_instances 512 --max_len 21
I require the PATH_TO_MODEL
how do I locate the model.json
file that was just pulled?
I've tried using solutions from here but unfortunately I'm unable to locate the pulled directory.
I've also tried downloading the repo from Github and then passing the location of the model.json
file and it yields an error
FileNotFoundError: [Errno 2] No such file or directory: '/Users/Luke/Downloads/CRNN-OCR-lite-master/models/OCR_IAM_ver1/model.json'
Please Advise.
I'm using macOS Big Sur.
Upvotes: 0
Views: 178
Reputation: 107
I am a newbie at this. But I think I have a solution.
I pulled the docker image and it seems like if you replace %PATH_TO_MODEL% with models in your python3 command - it works!
Here is what the final command looks like:
python3 predict.py --G 0 --model_path models \
--image_path %PATH_TO_IMAGES% \
--validate --num_instances 512 --max_len 21
If you do ls
once you are inside the docker container, you will be able to see all the directories.
__pycache__ boot dev home lib64 mnt opt proc run srv tmp usr var
bin data etc lib media models predict.py root sbin sys train.py utils.py
I am not sure if this helps, but let me know.
Upvotes: 2
Reputation: 15309
After running this line:
docker run --rm -it -v /home:/data -p 8004:8000 gasparjan/crnn_ocr:cpu
you will be dropped inside the container's command line. You can look around with ls
:
➜ sudo docker run --rm -it -v /home:/data -p 8004:8000 gasparjan/crnn_ocr:cpu
root@0e2914bb1aad:/#
root@0e2914bb1aad:/# ls -la
total 124
drwxr-xr-x 1 root root 4096 Apr 27 13:36 .
drwxr-xr-x 1 root root 4096 Apr 27 13:36 ..
-rwxr-xr-x 1 root root 0 Apr 27 13:36 .dockerenv
drwxr-xr-x 1 root root 4096 May 14 2019 bin
drwxr-xr-x 2 root root 4096 Apr 12 2016 boot
drwxr-xr-x 3 root root 4096 Apr 27 13:35 data
drwxr-xr-x 5 root root 360 Apr 27 13:36 dev
drwxr-xr-x 1 root root 4096 Apr 27 13:36 etc
drwxr-xr-x 2 root root 4096 Apr 12 2016 home
drwxr-xr-x 1 root root 4096 May 14 2019 lib
drwxr-xr-x 1 root root 4096 May 14 2019 lib64
drwxr-xr-x 2 root root 4096 Jan 22 2019 media
drwxr-xr-x 2 root root 4096 Jan 22 2019 mnt
drwxr-xr-x 2 root root 4096 May 14 2019 models
drwxr-xr-x 2 root root 4096 Jan 22 2019 opt
-rw-rw-r-- 1 root root 8034 May 11 2019 predict.py
dr-xr-xr-x 378 root root 0 Apr 27 13:36 proc
drwx------ 1 root root 4096 May 14 2019 root
drwxr-xr-x 1 root root 4096 May 14 2019 run
drwxr-xr-x 1 root root 4096 Jan 22 2019 sbin
drwxr-xr-x 2 root root 4096 Jan 22 2019 srv
dr-xr-xr-x 13 root root 0 Apr 27 13:37 sys
drwxrwxrwt 1 root root 4096 May 14 2019 tmp
-rw-rw-r-- 1 root root 8572 May 10 2019 train.py
drwxr-xr-x 1 root root 4096 Jan 22 2019 usr
-rw-rw-r-- 1 root root 23446 May 10 2019 utils.py
drwxr-xr-x 1 root root 4096 Jan 22 2019 var
root@0e2914bb1aad:/# ls -la /models
total 55892
drwxr-xr-x 2 root root 4096 May 14 2019 .
drwxr-xr-x 1 root root 4096 Apr 27 13:36 ..
-rw-r--r-- 1 root root 490 Jan 24 2019 arguments.txt
-rw-r--r-- 1 root root 11482392 Mar 24 2019 checkpoint_weights.h5
-rw-r--r-- 1 root root 34189880 Jan 24 2019 final_model.h5
-rw-r--r-- 1 root root 11482392 Jan 24 2019 final_weights.h5
-rw-r--r-- 1 root root 136 Jan 24 2019 loss_history.pickle.dat
-rw-r--r-- 1 root root 31729 Jan 24 2019 model.json
-rw-r--r-- 1 root root 15524 Jan 24 2019 model_summary.txt
So the file is at /models/model.json
inside the container!
As for the images, I couldn't find any images inside the container. I think you are meant to supply your own. In that case, look at the command (/home:/data
). This is a bind mount which means that /home
on your PC and /data
inside the container are the same folder now.
So I would try adding some images to your PC's /home
folder and then, inside the container, running:
python3 predict.py --G 0 --model_path /models/model.json \
--image_path /data \
--validate --num_instances 512 --max_len 21
Upvotes: 2