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

where to put images folder, localhost, etc? #1

Open
1997mjk opened this issue Nov 18, 2016 · 11 comments
Open

where to put images folder, localhost, etc? #1

1997mjk opened this issue Nov 18, 2016 · 11 comments

Comments

@1997mjk
Copy link

1997mjk commented Nov 18, 2016

Hey, I used docker with Digital Command, and put the images folder (and data.json) in the server there.
About time curl localhost:8000 --data-binary @image.jpg -vv, is the image.jpg supposed to be one of the images of one of the person? Right now, if I try to do that, it just says "Couldn't read data from "nameOfImage.jpg", this makes an empty POST"

Also, do I need to change the OpenFaceUrl from "http://ml.cer.auckland.ac.nz:8000" to something else as well?
Thanks in advance

@neon-ninja
Copy link
Member

time curl localhost:8000 --data-binary @image.jpg -vv is an example of how to test the endpoint. With machine learning, it's not really a fair test to give it an image it's seen before, you need to show it something it's never seen. For me, my torch network was trained on my image from the University of Auckland staff directory (which is also my github profile picture), and I posted it my passport photo. It was able to correctly identify me, even though the torch network had never seen my passport photo before, and there was >3000 other photos in the network.

image.jpg must be a valid jpg file in the current working directory when using this curl command, and you must have the read permission on that file (chmod a+r image.jpg). If it's someone in the network, that's good, but if not, you'll still get the closest match. If your dataset is as large as mine, the closest match will look quite a bit like them.

OpenFaceUrl

Looks like you're referring to https://github.com/UoA-eResearch/hololens_facial_recognition/blob/master/config.cfg.example - yes, you would need to change this to the hostname of the server running your torch network. I run my docker container on ml.cer.auckland.ac.nz but this server is not accessible outside of my network.

Did generate_pickle.py work ok for you? You can use docker logs omc to check the logs.

Thanks for being the first (that I know of) to test this!

@neon-ninja
Copy link
Member

Also, your images folder and your data.json can be anywhere on your machine, it gets mounted to /root/data in the container with the argument --volume="`pwd`:/root/data" to docker run. `pwd` being a bash command that prints the current directory - this command is intended to run while you're in the directory containing your images folder.

@neon-ninja
Copy link
Member

neon-ninja commented Nov 23, 2016

Also I took a look at https://github.com/1997mjk/OpenFaceHoloLens - generate_pickle.py wasn't handling multiple samples per person, and wouldn't have supported your JSON structure, but my last few commits make it so that it does.

@geziefer
Copy link

geziefer commented Feb 2, 2017

It may be a good idea to upload a sample data.json and image folder structure like 1997mjk did for others to understand immediately how it should look like.

@twobob
Copy link

twobob commented May 11, 2017

Hmm. So I made a folder called "images" and filled it with named folders like "bob" and the relevant peoples images. I replaced powershell curl with the real one (windows here) via chocolately and tried

PS C:\WINDOWS\system32> curl localhost:8000 --data-binary ":\Users\deeplearn\Pictures\dockerstuff\IMG_3157.jpg" -vv

  • Rebuilt URL to: localhost:8000/
  • Trying 127.0.0.1...
  • TCP_NODELAY set
  • Trying ::1...
  • TCP_NODELAY set
  • connect to 127.0.0.1 port 8000 failed: Connection refused
  • connect to ::1 port 8000 failed: Connection refused
  • Failed to connect to localhost port 8000: Connection refused
  • Closing connection 0
    curl: (7) Failed to connect to localhost port 8000: Connection refused
    PS C:\WINDOWS\system32>

I also double checked my startup via

PS D:\Users\deeplearn\Pictures\dockerstuff\putImagesFolderUnderHere> docker run --name=omc --restart=always --detach=true --volume="pwd:/root/data" --publish="8000:8000" --net=host uoacer/openface-mass-compare

8b3ae7e4bf1ffd424ed0c610b223052e1c808e8b1b22ec4736d3d66fc3405a19
PS D:\Users\deeplearn\Pictures\dockerstuff\putImagesFolderUnderHere> docker logs -f omc
[2017-05-11 13:22:26 +0000] [6] [INFO] Starting gunicorn 19.7.1
[2017-05-11 13:22:26 +0000] [6] [INFO] Listening at: http://0.0.0.0:8000 (6)
[2017-05-11 13:22:26 +0000] [6] [INFO] Using worker: sync
[2017-05-11 13:22:26 +0000] [11] [INFO] Booting worker with pid: 11
[2017-05-11 13:22:26 +0000] [13] [INFO] Booting worker with pid: 13
[2017-05-11 13:22:26 +0000] [15] [INFO] Booting worker with pid: 15
[2017-05-11 13:22:26 +0000] [17] [INFO] Booting worker with pid: 17
[2017-05-11 13:22:26 +0000] [19] [INFO] Booting worker with pid: 19
[2017-05-11 13:22:26 +0000] [21] [INFO] Booting worker with pid: 21
[2017-05-11 13:22:26 +0000] [23] [INFO] Booting worker with pid: 23
[2017-05-11 13:22:26 +0000] [25] [INFO] Booting worker with pid: 25
Loaded stored pickle, took 7.86781311035e-06
(Repeated 8 timesish alternately with next message)
('Unable to load data.json: ', IOError(2, 'No such file or directory'))
(Repeated 8 timesish alternately with previous message)

Am I something really obvious?

Many thanks

@neon-ninja
Copy link
Member

The pwd command does not work in windows

@twobob
Copy link

twobob commented May 12, 2017

actually. in powershell it does, but the problem is not that. any combination will also not work
Basically enabling the shares at all seems to be not working OOTB at the moment under windows.
Tried the various workarounds. and advised settings. people have alleged getting a share to work.
I could not.
In the end I settled for running it under the linux Player and manually shoving some files in there via direct sudo docker exec -it omc /bin/bash and rerunning pickle maker, this worked.
So. basically under windows YMMV with this. :) hope that helps
doing it this way also still enables the REST service to be available from the windows host anyway at port 8000 so. win win
winwin

@neon-ninja
Copy link
Member

image

I think in windows you need to replace `pwd` with $pwd

@neon-ninja
Copy link
Member

maybe https://github.com/docker/for-win/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20mount might have a solution for mounts not working on windows

@twobob
Copy link

twobob commented May 12, 2017

well - more specifically moby/moby#12751
But as I said. the pwd is the least of the worries ;) hard coded also fails,

PS D:> docker run -v "${pwd}:/test" alpine ls /test
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid bind mount spec "D:\:/test ": invalid mode: /test.

if there is a simple solution I am yet to find it. MSYS_NO_PATHCONV=1 and the other env stuff looked promising...

however I did cobble a working container together and thanks to the slap happy perms on windows -> unix I can just cif files directly into the VM -> containers data directly from in the win box. so no harm done. it's actually pretty useful now like that.

thanks, but I would really enjoy a more solid solution obviously.

@twobob
Copy link

twobob commented May 13, 2017

installing and configuring a server side samba server is a windows friendly option in the absence of access to native files shares. Thanks for the great work on this.

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

4 participants