mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

OpenCV is unavailable Message and no output for distributed training

Open wsybupt opened this issue 10 years ago • 16 comments

I have 2 ssh-able machines , and this mxnet folder is in the same place on these machines. When I running:

tools/launch.py -n 2 -H hosts python example/image-classification/train_mnist.py --kv-store dist_sync

on one machine. There is just the message said that " OpenCV is unavailable". When I input the command "top" on the other machine, I can see there is 2 python process.

I just read the README.MD at https://github.com/dmlc/mxnet/tree/master/example/image-classification. Is there something wrong?

wsybupt avatar Dec 11 '15 09:12 wsybupt

This happens to me on some machines as well and I do not know what was the cause, but since python process occured, it should run without a problem

tqchen avatar Dec 11 '15 15:12 tqchen

So simply ignoring the message should be fine

tqchen avatar Dec 11 '15 15:12 tqchen

This happens to me too, and check the codes here: https://github.com/dmlc/mxnet/blob/master/python/mxnet/recordio.py#L14-L19 So you may install the cv2. I choose to ignore it, because I don't want to recompile opencv to install cv2.

zhangchen-qinyinghua avatar Dec 11 '15 19:12 zhangchen-qinyinghua

I added that message in recordio.py. I'll try to make it explicit that when you are not using recordio.pack_img the error is harmless

piiswrong avatar Dec 12 '15 01:12 piiswrong

 pip install cv2

this happens to me too, I use pip to install cv2, it doesn't work, I solve this by

yum install opencv-python

ps: centos 7.1


maybe you should install opencv-python firstly

qiaohaijun avatar Dec 12 '15 14:12 qiaohaijun

@tqchen Actually, I ignored the message, but my problem is that except this message there is nothing else on the screen. When I run the mnist example on one machine, I can see the output of the program such as time, accuracy and so on. And after 5 minutes, the training is done. But when I do the distributed training, there is nothing on the screen except the message "OpenCV is unavailable". I don't know what the computer is doing. I have waiting for many hours, but there is noting. Do you know what is wrong?

wsybupt avatar Dec 13 '15 11:12 wsybupt

@zhangchen-qinyinghua Yes, I did not install openCV and I know it. When I train the mnist on one machine there is also the message, but I can see that the training is done after 5 minutes. But when I do the distribute training , there is noting else on the screen. Do you have any suggests?

wsybupt avatar Dec 13 '15 12:12 wsybupt

Can you parse the full log? It may be due to the launcher is failed to get a valid ip

mli avatar Dec 14 '15 04:12 mli

@mli How to parse the full log?

wsybupt avatar Dec 15 '15 02:12 wsybupt

i mean ctrl-c all outputs of mxnet and then ctrl-v into this issue

On Mon, Dec 14, 2015 at 9:36 PM, wsybupt [email protected] wrote:

@mli https://github.com/mli How to parse the full log?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/903#issuecomment-164625158.

mli avatar Dec 15 '15 02:12 mli

@mli Before I install openCV, all of the output is "OpenCV is unavailable"

Now:

wsy@wsy-ThinkCentre-XXXX:/mxnet/example/image-classification$ ../../tools/launch.py -n 2 -H hosts python train_mnist.py --kv-store dist_sync
^C2015-12-15 10:46:50,444 INFO Stop luancher
wsy@wsy-ThinkCentre-XXXX:/mxnet/example/image-classification$ 

Last night I let the computer run for a whole night, but nothing else show up.

wsybupt avatar Dec 15 '15 02:12 wsybupt

i guess i know the bug..

you may try to run the following codes in python to see if you get the same results as mine:

>>> import socket
>>> socket.gethostbyname(socket.getfqdn())
'127.0.1.1'
>>> socket.gethostbyname(socket.gethostname())
'127.0.1.1'

which means the above approach cannot get the correct ip. a related issue is here

http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib

i'm trying to figure out how to update tracker.py @tqchen FYI

mli avatar Dec 15 '15 03:12 mli

should be fixed by #936

please have a git pull and git submodule update

mli avatar Dec 15 '15 03:12 mli

@mli Thank you very much! Now the message is like this

wsy@wsy-ThinkCentre-XXXX:/mxnet/example/image-classification$ sudo ../../tools/launch.py -n 1 -H hosts python train_mnist.py --kv-store dist_sync
[sudo] password for wsy: 
2015-12-15 14:02:56,312 Node[0] start with arguments Namespace(batch_size=128, data_dir='mnist/', gpus=None, kv_store='dist_sync', load_epoch=None, lr=0.1, lr_factor=1, lr_factor_epoch=1, model_prefix=None, network='mlp', num_epochs=10, num_examples=60000)
[14:02:57] src/io/iter_mnist.cc:91: MNISTIter: load 60000 images, shuffle=1, shape=(128,784)
[14:02:58] src/io/iter_mnist.cc:91: MNISTIter: load 10000 images, shuffle=1, shape=(128,784)
2015-12-15 14:02:58,346 Node[0] Start training with [cpu(0)]
2015-12-15 14:02:58,801 Node[0] Iter[0] Batch [50] Speed: 14611.60 samples/sec
2015-12-15 14:02:59,193 Node[0] Iter[0] Batch [100] Speed: 16359.00 samples/sec
...

Is it correct? It looks the same as running local.

wsybupt avatar Dec 15 '15 06:12 wsybupt

yeah, that seems normal.

you may want to use a large problem (more complex network, larger dataset, and gpus) in order to see the benefit of distributed training

mli avatar Dec 15 '15 15:12 mli

@mli Launch.py failed to get a valid ip when I test train_mnist on local machine(windows) by using some workers?()

cupermanrose avatar Feb 24 '16 11:02 cupermanrose