-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Python trained model gives different features set in C++ #12869
Comments
@MyraBaba thanks for your question and thanks for trying out the C++ API. Could you please bring me more context on the difference with the result? How would you build your C++ package and your system info? @mxnet-label-bot please add label [C++, Question] |
Hi System is Mac os X and also ubuntu 18 We want to use Mxnet in our all production. We just stuck in first attemp :) https://github.com/blob/master/deploy/test.py this is the our first test. We can extract feature in pyhton. We tried to use predict-cpp api to use model and extract future with same model above first message . c++ image-classification-predict-cpp we put same model same picture in the above repo Tom-hanks. it gives different outpu (512D but different float numbers). Clearly we are missing something because we are new to mxnet . Basically ; We want to this in c++ as in python and want to get same features: img = cv2.imread('Tom_Hanks_54745.png') img = model.get_input(img) Best... |
any idea ? what could be the basic steps in C++ for :
We loved the mxnet framework bu fi we cant use it in our C++ environment unfortunately we have to drop mxnet and back to the old system. for mxnet experts specially on the C , C++ side it should be trivial example which means a lot for the community. What we can do to make it works ? |
@MyraBaba
I will try out your model with that example. Will update this issue with my observations. |
We almost exhausted :) It certainly should work but we are very new to mxnet framwork. On the other hand training speed and mem usage fantastic. If we succesfully get same results in c++ as in our python test.py we will change our AI to the mxnet completely . Thanks for your help and attention. Best |
With my test program I was able to get the output of float vector of 512. Without using sklearn.preprocessing.normalize on that output (similar to what was done in the test python script), the maximum accuracy was reported to be 2.7216 at index 84. The rest of the entries in 512D vector were 0.03412. ( I have used the same image as that of test.py) I did not normalize the image before running forward pass. |
I will work on your c++ code and try to make progress.
I will run under the cpp-package /example/ feature_extract. Right ?
I can finalise this week this we will move money and there will be support requested we can discuss separately
Best
… On 22 Oct 2018, at 20:42, Amol Lele ***@***.***> wrote:
With my test program I was able to get the output of float vector of 512. Without using sklearn.preprocessing.normalize on that output (similar to what was done in the test python script), the maximum accuracy was reported to be 2.7216 at index 84. The rest of the entries in 512D vector were 0.03412. ( I have used the same image as that of test.py)
I did not normalize the image before running forward pass.
If this helps, I can share the code of my example.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#12869 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQscn9zC_lg0ZG6AfMOZUy_oGMhnxeygks5ungN2gaJpZM4XvOz7>.
|
@MyraBaba Please let us know if you need help. |
Can you share your code that you mentioned above please , I will start from your code. |
@leleamol I used synset.tx (inception) with below command and get error below.: How did you run exactly for tom_hanks (112x112) ?
` |
@MyraBaba The synset file and mean image file are not mandatory. But there is a bug in code that mandates synset file to be specified. I am sending out the fix. inception_inference --symbol <model_json_file> --params --image --synset <./synset file> --input_shape "3 112 112" |
Here is the PR #12930 after fixing the example. |
@leleamol How I can contact you ? have you email ? I could be get paid support from you / also a contribution for your effort . Best |
@MyraBaba you can join our Slack channel where everybody can ask questions and it's for free! |
@MyraBaba as @lanking520 suggested you can join the slack channel and can ask questions there. |
@leleamol Thanks for your PR it is very good start for me. But time is limited for me and I need the produce same results for same picture as in python version which is requires more deep knowledge mxnet & align and normalisation I think. |
I send mail to slack channel and it got bact to me error. FYI |
@MyraBaba you can send a email to [email protected] requesting an invite, we'll invite your email address. |
Hi @leleamol I am trying to integrate and testing your new inference. do you know the equilavent of the beloq python code in mxnet or Ndarray ? : distance = numpy.sum(numpy.square(descA512 - descB512)) I will test with my own preprocessed faces first to see difference.. |
than I can use ** instead of numpy.square right ? PS: I have trouble to linking #12930 in cmake . what could be the proper way to do in cmake ? Best |
You should be able to use "*" operator in NDArray to get the square. Regarding #12930 the example contains Makefile. What is the error that you are getting? |
@mxnet-label-bot add [Pending Requester Info] |
@leleamol Hi, I am back to project and able to compile with Cmake ypur inception_inference.cpp with above mentioned models. Can you direct me to where is the output of float vector of 512 variable ? can I get this 512 float vector features with this .cpp ? If so I couldnt find it with debugging. Could you possibly let me Best
|
Hi @MyraBaba In the [inception_inference.cpp] https://github.com/apache/incubator-mxnet/blob/master/cpp-package/example/inference/inception_inference.cpp example, you can add following line
after the line [309]https://github.com/apache/incubator-mxnet/blob/master/cpp-package/example/inference/inception_inference.cpp#L309. In the example, we use ArgmaxChannel on this output to get the index with highest probability. |
@MyraBaba : Were you able to output the float vector? Just checking in to see how you were doing with using the CPP example for your use-case. If you were able to successfully use the CPP example, could we close this issue? |
when I add the LG << array saw the output. now I need to test both python and the c++ inference outputs is same. best |
@MyraBaba Close this issue for now, Please feel free to reopen if problem persist. |
Hi,
We have model trained in python and want to use it from c++ as for getting 512D float features.
c++ gives different output when we try with image-classification-predict.cpp
We just want to get data (as in code) 512d float vector as in python output ?
model:
https://pan.baidu.com/s/1mj6X7MK
or
https://www.dropbox.com/s/ou8v3c307vyzawc/model-r50-arcface-ms1m-refine-v1.zip?dl=0
Isnt there a clear method for C++ feature extraction ?
Best
The text was updated successfully, but these errors were encountered: