FaceBoxes-tensorflow
FaceBoxes-tensorflow copied to clipboard
How to run on cpu ?
Thanks you ! I have only cpu and i run this project on cpu. My error : self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Default MaxPoolingOp only supports NHWC on device type CPU [[Node: import/pool1/MaxPool = MaxPoolT=DT_FLOAT, data_format="NCHW", ksize=[1, 1, 3, 3], padding="SAME", strides=[1, 1, 2, 2], _device="/job:localhost/replica:0/task:0/device:CPU:0"]] how to fix this error ? Thanks you very much @TropComplique ?
Can someone help me? Thanks
Hi. To run this on CPU you will need to change all NCHW
tensors to NHWC
tensors.
For example:
- Change axis here (
1 -> 3
): https://github.com/TropComplique/FaceBoxes-tensorflow/blob/master/src/network.py#L22 - Change
NCHW
toNHWC
here: https://github.com/TropComplique/FaceBoxes-tensorflow/blob/master/src/network.py#L36 - Also, make changes in this function: https://github.com/TropComplique/FaceBoxes-tensorflow/blob/master/src/detector.py#L242
But these are not all places you will need to change.
You can find other places by yourself.
After these changes, you will need to refreeze the graph using save.py
and create_pb.py
.
https://pan.baidu.com/s/1Y5LJ8mzVKoALTEyaUklkAA here is the cpu version of this PR, including a trained model.
@tirtile do you convert trained model of TropCompile to CPU or you trained from scratch ?
@tirtile thank for your share. Can you give me advice to train your NHWC model? I tried to train the faceboxes to detect bottle. I trained the model by TropComplique's code, it can detect the bottle. But when I used the same .tfrecord to train the model by your code, it detect nothing in same image. Is there anything change in generate the train dataset? Looking forward for your reply!
@vipcualo @junedgar I trained the model according to config.json in this PR and changed nothing except data format.
@tirtile :when is it the loss value you stop the training?
@junedgar Do you find the reason? I used tritile's NHWC code also detected nothing in same image. It's very strange... Is there anything wrong during saving PB file?
@hahasofia I used the wrong model. I ran the 'save.py' script, the model.pb was saved in root directory. I used a model in subdirectory with the some name, so i detect nothing. You can check if you used the correct model.
@junedgar I used right model file, but I changed detector.py because I met error below when ran 'save.py'. So I'm not sure whether my changes affect the result. Do you meet below error? Thank you.
@tirtile I'd love to try your CPU model, but it looks like the link you posted expired. Any chance you can rehost it?
Hi.
Now the .pb
file also works on CPU.
33 fps on an image with size 1024x768.
@hahasofia yes, I encountered this problem, you can solve it by using python3.
@TropComplique Hi. Use you provide .pb works on CPU speed:100ms per image, How did you test it?Is the test code provider
@TropComplique Hi. Use you provide .pb works on CPU speed:100ms per image, How did you test it?Is the test code provider
I got 300ms on CPU. Did you also get 33FPS?