imsoo / darknet_server

Darknet (Open source neural networks framework) Server
MIT License
28 stars 8 forks source link

Loading weights from ...Couldn't open file: #1

Open ChangSeobYun opened 4 years ago

ChangSeobYun commented 4 years ago

When you run worker, "Loading weights from ... Coouldn't open file:" error occurs.

imsoo commented 4 years ago

@ChangSeobYun Hi,

  1. Which do you want to run, Yolo or Openpose?

  2. Did you download weight file and put it in "weight" directory?

  3. Please write your full command , it should be like

    ./worker "YOUR CFG PATH" "WEIGHT PATH" "NAMES PATH" -gpu 0 -thresh 0.2
    ./worker cfg/yolov3.cfg weights/yolov3.weights names/cooc.names -gpu 0 -thresh 0.2
ChangSeobYun commented 4 years ago

I solved. thanks

ChangSeobYun commented 4 years ago

I have another question. what is ./sink and ./ventilator?

imsoo commented 4 years ago

@ChangSeobYun

For example,

  1. client sends the webcam video stream to the server(Ventilator).

    Client -- Frame4 -- Frame 3 -- Frame 2 -- Frame 1 --> Server (Ventilator)
  2. Ventilator receive frame and distribute to Worker. (In this case, Assume that three Worker processes are running)

    Ventilator -- Frame 1 --> Worker 1   
    Ventilator -- Frame 2 --> Worker 2
    Ventilator -- Frame 3 --> Worker 3
    Ventilator -- Frame 4 --> Worker 1 
    (Repeat)
  3. Workers process frame (neural network computation) and send result to Sink. (Note that worker 3 could process faster than worker 2)

    Worker 1 -- Processed Frame 1 --> Sink   
    Worker 3 -- Processed Frame 3 --> Sink   
    Worker 2 -- Processed Frame 2 --> Sink   
  4. Sink collects results back from the worker and send result to client in sequence

    Workers -- Frame 2 -- Frame 3 -- Frame 1 --> Sink -- Frame 3 -- Frame 2 -- Frame 1 --> Client

Why use this?

Suppose the time to process one frame is 1 second. If there are five frame and one worker process, it takes 5 seconds. However, using two workers, it will be halved.

1 worker: total elapsed time: 5034 msecs.
2 workers: total elapsed time: 2421 msecs.
4 workers: total elapsed time: 1018 msecs.

accompanying document should help: http://zguide.zeromq.org/page:all#Divide-and-Conquer

ChangSeobYun commented 4 years ago

I don't raw output detection box. what is problem?

imsoo commented 4 years ago

@ChangSeobYun

  1. Check that the Server-Client is working.

Set DEBUG flag in Makefile and rebuild it. and then check standard output.

https://github.com/imsoo/darknet_server/blob/93a32e44d18ecdcc49d3803dc0d4947eef03bd3c/server/Makefile#L1

run server (sink, ventilator, one worker process) and then run client It should be like :

Ventilator | Recv From Client | SEQ :  0 | LEN : 12345
Ventilator | Send To Worker | SEQ :  0 | LEN : 12345
...
Worker | Recv From Ventilator | SEQ :  0 | LEN : 12345
Darknet | Detect | SEQ : 0 | Time : 50ms
Worker | Send To Sink | SEQ :  0 | LEN : 13456
...
Sink | Recv From Worker | SEQ : 0 | LEN : 13456
Sink | Pub To Client | SEQ : 0 | LEN : 13456
  1. If networking is fine, then try to change threshold.
./worker cfg/yolov3.cfg weights/yolov3.weights names/cooc.names -gpu 0 -thresh ***0.2***
  1. Please write your full command or post any picture. It should be helpful.
ChangSeobYun commented 4 years ago

제목 없음

ChangSeobYun commented 4 years ago

./worker cfg/openpose.cfg weights/openpose.weight -gpu 0 -pose

imsoo commented 4 years ago

I think that Server/Client couldn't connect.

  1. where is the server running? Local OR Remote (GCP, AWS ...)

  2. check that server address in client command.

For example (Local),

 ./darknet_client -addr 127.0.0.1 -vid test.mp4
  1. Please post server process's (Sink, Ventilator, Worker) output.
ChangSeobYun commented 4 years ago

I solved. thanks. An error occurred while executing the action.py ImportError: cannot import name 'set_session' from 'tensorflow.keras.backend'

imsoo commented 4 years ago

@ChangSeobYun

I think that different keras version is a cause of this error. Which version of tensorflow and keras do you have? if you let me know, i will try it.

ChangSeobYun commented 4 years ago

tensorflow==2.1.0 and Keras==2.3.1

imsoo commented 4 years ago

@ChangSeobYun

Note : This is a temporary solution. it may not work correctly in your environment. So please let me know the result.

Try to change 7-12 Line in action.py and retry it.

From

from tensorflow.keras.backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
set_session(sess)
sess.run(tf.global_variables_initializer())

To

## TF 2.0
from tensorflow.compat.v1.keras.backend import set_session
tf.compat.v1.disable_eager_execution()
config = tf.compat.v1.ConfigProto()  
config.gpu_options.allow_growth = True
sess = tf.compat.v1.Session(config=config)
set_session(sess)
sess.run(tf.compat.v1.global_variables_initializer())
ChangSeobYun commented 4 years ago

i just use one computer. then not working

ChangSeobYun commented 4 years ago

제목 없음

imsoo commented 4 years ago

@ChangSeobYun

Is the server (worker, Sink, Ventilator) running on the same computer?

moonbeam5115 commented 3 years ago

@ChangSeobYun Hi,

1. Which do you want to run, Yolo or Openpose?

2. Did you download weight file and put it in "weight" directory?

3. Please write your full command , it should be like
./worker "YOUR CFG PATH" "WEIGHT PATH" "NAMES PATH" -gpu 0 -thresh 0.2
./worker cfg/yolov3.cfg weights/yolov3.weights names/cooc.names -gpu 0 -thresh 0.2

Hi @imsoo, great work with this repo! I am having a similar issue to the issue shown at the top:

Loading weights from ...Couldn't open file

I am running the following: ./sink ./ventilator ./worker cfg/yolov3.cfg weights/yolov3.weights names/coco.names -gpu 0 -thresh 0.2

and then am getting the error. Any ideas on how to fix this? Also, after running ./sink and ./ventilator am I supposed to be getting output on the terminal? Because I am not getting any output after running them.

SinDongHwan commented 3 years ago

안녕하세요, @imsoo.

저도 같은 에러가 발생했는데요.

darknet, darknet_server를 받아서 make까지 완료하였고, sink와 ventilator를 실행하고나서 이 issue에서 가이드 해주신 명령어대로 worker를 실행했는데도 오류가 발생합니다.

왜 "Loading weights from ...Couldn't open file" 에러 메세지가 뜨는 지 아시나요?