ImportError: cannot import name '_obtain_input_shape' [duplicate]










0
















This question already has an answer here:



  • ImportError: cannot import name '_obtain_input_shape' from keras

    3 answers



When I run



from keras_vggface.vggface import VGGFace

# Based on VGG16 architecture -> old paper(2015)
vggface = VGGFace(model='vgg16') # or VGGFace() as default

# Based on RESNET50 architecture -> new paper(2017)
vggface = VGGFace(model='resnet50')

# Based on SENET50 architecture -> new paper(2017)
vggface = VGGFace(model='senet50')


in instructions.



I got this error



ImportError: cannot import name '_obtain_input_shape'



I follow the instructions in install the keras_vggface. And here is a list info of my packages.



# packages in environment at /Users/lzq/anaconda3/envs/py36_faceRec:
#
# Name Version Build Channel
bleach 1.5.0 <pip>
ca-certificates 2018.03.07 0
certifi 2018.10.15 py36_0
enum34 1.1.6 <pip>
h5py 2.8.0 <pip>
html5lib 0.9999999 <pip>
Keras 2.1.1 <pip>
keras-vggface 0.5 <pip>
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20170329 hb402a30_2
libffi 3.2.1 h475c297_4
Markdown 3.0.1 <pip>
ncurses 6.1 h0a44026_0
numpy 1.15.4 <pip>
openssl 1.1.1 h1de35cc_0
Pillow 5.3.0 <pip>
pip 18.1 py36_0
protobuf 3.6.1 <pip>
python 3.6.7 haf84260_0
PyYAML 3.13 <pip>
readline 7.0 h1de35cc_5
scipy 1.1.0 <pip>
setuptools 40.5.0 py36_0
six 1.11.0 <pip>
sqlite 3.25.2 ha441bb4_0
tensorflow 1.4.0 <pip>
tensorflow-tensorboard 0.4.0 <pip>
tk 8.6.8 ha441bb4_0
Werkzeug 0.14.1 <pip>
wheel 0.32.2 py36_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 hf3cbc9b_2









share|improve this question















marked as duplicate by Community Nov 13 '18 at 16:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • What research have you done? Show what steps you have taken to solve this in the question with an edit. For example, how is stackoverflow.com/q/49113140/1531971 not a duplicate issue?

    – jdv
    Nov 13 '18 at 16:00












  • It is not a duplicate. I did not run "from keras.applications.imagenet_utils import _obtain_input_shape", I just tried to study the package and run some simple codes in the link I provided

    – Pengfei Li
    Nov 13 '18 at 16:07












  • You need to prove that all the advice in that link does not apply here. What versions are you trying to use? Have you proven the assertion that the version(s) you think you have are being used? There is a lot of info in that related link, and it is your responsibility to tell us how none of it applies. The fact is that _obtain_input_shape does not exist in your version of this dependency, and this is required to import the dependency. Find out why.

    – jdv
    Nov 13 '18 at 16:10












  • I modified my questions. Hope it makes sense now.

    – Pengfei Li
    Nov 13 '18 at 16:12















0
















This question already has an answer here:



  • ImportError: cannot import name '_obtain_input_shape' from keras

    3 answers



When I run



from keras_vggface.vggface import VGGFace

# Based on VGG16 architecture -> old paper(2015)
vggface = VGGFace(model='vgg16') # or VGGFace() as default

# Based on RESNET50 architecture -> new paper(2017)
vggface = VGGFace(model='resnet50')

# Based on SENET50 architecture -> new paper(2017)
vggface = VGGFace(model='senet50')


in instructions.



I got this error



ImportError: cannot import name '_obtain_input_shape'



I follow the instructions in install the keras_vggface. And here is a list info of my packages.



# packages in environment at /Users/lzq/anaconda3/envs/py36_faceRec:
#
# Name Version Build Channel
bleach 1.5.0 <pip>
ca-certificates 2018.03.07 0
certifi 2018.10.15 py36_0
enum34 1.1.6 <pip>
h5py 2.8.0 <pip>
html5lib 0.9999999 <pip>
Keras 2.1.1 <pip>
keras-vggface 0.5 <pip>
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20170329 hb402a30_2
libffi 3.2.1 h475c297_4
Markdown 3.0.1 <pip>
ncurses 6.1 h0a44026_0
numpy 1.15.4 <pip>
openssl 1.1.1 h1de35cc_0
Pillow 5.3.0 <pip>
pip 18.1 py36_0
protobuf 3.6.1 <pip>
python 3.6.7 haf84260_0
PyYAML 3.13 <pip>
readline 7.0 h1de35cc_5
scipy 1.1.0 <pip>
setuptools 40.5.0 py36_0
six 1.11.0 <pip>
sqlite 3.25.2 ha441bb4_0
tensorflow 1.4.0 <pip>
tensorflow-tensorboard 0.4.0 <pip>
tk 8.6.8 ha441bb4_0
Werkzeug 0.14.1 <pip>
wheel 0.32.2 py36_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 hf3cbc9b_2









share|improve this question















marked as duplicate by Community Nov 13 '18 at 16:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • What research have you done? Show what steps you have taken to solve this in the question with an edit. For example, how is stackoverflow.com/q/49113140/1531971 not a duplicate issue?

    – jdv
    Nov 13 '18 at 16:00












  • It is not a duplicate. I did not run "from keras.applications.imagenet_utils import _obtain_input_shape", I just tried to study the package and run some simple codes in the link I provided

    – Pengfei Li
    Nov 13 '18 at 16:07












  • You need to prove that all the advice in that link does not apply here. What versions are you trying to use? Have you proven the assertion that the version(s) you think you have are being used? There is a lot of info in that related link, and it is your responsibility to tell us how none of it applies. The fact is that _obtain_input_shape does not exist in your version of this dependency, and this is required to import the dependency. Find out why.

    – jdv
    Nov 13 '18 at 16:10












  • I modified my questions. Hope it makes sense now.

    – Pengfei Li
    Nov 13 '18 at 16:12













0












0








0









This question already has an answer here:



  • ImportError: cannot import name '_obtain_input_shape' from keras

    3 answers



When I run



from keras_vggface.vggface import VGGFace

# Based on VGG16 architecture -> old paper(2015)
vggface = VGGFace(model='vgg16') # or VGGFace() as default

# Based on RESNET50 architecture -> new paper(2017)
vggface = VGGFace(model='resnet50')

# Based on SENET50 architecture -> new paper(2017)
vggface = VGGFace(model='senet50')


in instructions.



I got this error



ImportError: cannot import name '_obtain_input_shape'



I follow the instructions in install the keras_vggface. And here is a list info of my packages.



# packages in environment at /Users/lzq/anaconda3/envs/py36_faceRec:
#
# Name Version Build Channel
bleach 1.5.0 <pip>
ca-certificates 2018.03.07 0
certifi 2018.10.15 py36_0
enum34 1.1.6 <pip>
h5py 2.8.0 <pip>
html5lib 0.9999999 <pip>
Keras 2.1.1 <pip>
keras-vggface 0.5 <pip>
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20170329 hb402a30_2
libffi 3.2.1 h475c297_4
Markdown 3.0.1 <pip>
ncurses 6.1 h0a44026_0
numpy 1.15.4 <pip>
openssl 1.1.1 h1de35cc_0
Pillow 5.3.0 <pip>
pip 18.1 py36_0
protobuf 3.6.1 <pip>
python 3.6.7 haf84260_0
PyYAML 3.13 <pip>
readline 7.0 h1de35cc_5
scipy 1.1.0 <pip>
setuptools 40.5.0 py36_0
six 1.11.0 <pip>
sqlite 3.25.2 ha441bb4_0
tensorflow 1.4.0 <pip>
tensorflow-tensorboard 0.4.0 <pip>
tk 8.6.8 ha441bb4_0
Werkzeug 0.14.1 <pip>
wheel 0.32.2 py36_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 hf3cbc9b_2









share|improve this question

















This question already has an answer here:



  • ImportError: cannot import name '_obtain_input_shape' from keras

    3 answers



When I run



from keras_vggface.vggface import VGGFace

# Based on VGG16 architecture -> old paper(2015)
vggface = VGGFace(model='vgg16') # or VGGFace() as default

# Based on RESNET50 architecture -> new paper(2017)
vggface = VGGFace(model='resnet50')

# Based on SENET50 architecture -> new paper(2017)
vggface = VGGFace(model='senet50')


in instructions.



I got this error



ImportError: cannot import name '_obtain_input_shape'



I follow the instructions in install the keras_vggface. And here is a list info of my packages.



# packages in environment at /Users/lzq/anaconda3/envs/py36_faceRec:
#
# Name Version Build Channel
bleach 1.5.0 <pip>
ca-certificates 2018.03.07 0
certifi 2018.10.15 py36_0
enum34 1.1.6 <pip>
h5py 2.8.0 <pip>
html5lib 0.9999999 <pip>
Keras 2.1.1 <pip>
keras-vggface 0.5 <pip>
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20170329 hb402a30_2
libffi 3.2.1 h475c297_4
Markdown 3.0.1 <pip>
ncurses 6.1 h0a44026_0
numpy 1.15.4 <pip>
openssl 1.1.1 h1de35cc_0
Pillow 5.3.0 <pip>
pip 18.1 py36_0
protobuf 3.6.1 <pip>
python 3.6.7 haf84260_0
PyYAML 3.13 <pip>
readline 7.0 h1de35cc_5
scipy 1.1.0 <pip>
setuptools 40.5.0 py36_0
six 1.11.0 <pip>
sqlite 3.25.2 ha441bb4_0
tensorflow 1.4.0 <pip>
tensorflow-tensorboard 0.4.0 <pip>
tk 8.6.8 ha441bb4_0
Werkzeug 0.14.1 <pip>
wheel 0.32.2 py36_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 hf3cbc9b_2




This question already has an answer here:



  • ImportError: cannot import name '_obtain_input_shape' from keras

    3 answers







keras anaconda






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 16:11







Pengfei Li

















asked Nov 13 '18 at 15:53









Pengfei LiPengfei Li

11




11




marked as duplicate by Community Nov 13 '18 at 16:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Community Nov 13 '18 at 16:30


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • What research have you done? Show what steps you have taken to solve this in the question with an edit. For example, how is stackoverflow.com/q/49113140/1531971 not a duplicate issue?

    – jdv
    Nov 13 '18 at 16:00












  • It is not a duplicate. I did not run "from keras.applications.imagenet_utils import _obtain_input_shape", I just tried to study the package and run some simple codes in the link I provided

    – Pengfei Li
    Nov 13 '18 at 16:07












  • You need to prove that all the advice in that link does not apply here. What versions are you trying to use? Have you proven the assertion that the version(s) you think you have are being used? There is a lot of info in that related link, and it is your responsibility to tell us how none of it applies. The fact is that _obtain_input_shape does not exist in your version of this dependency, and this is required to import the dependency. Find out why.

    – jdv
    Nov 13 '18 at 16:10












  • I modified my questions. Hope it makes sense now.

    – Pengfei Li
    Nov 13 '18 at 16:12

















  • What research have you done? Show what steps you have taken to solve this in the question with an edit. For example, how is stackoverflow.com/q/49113140/1531971 not a duplicate issue?

    – jdv
    Nov 13 '18 at 16:00












  • It is not a duplicate. I did not run "from keras.applications.imagenet_utils import _obtain_input_shape", I just tried to study the package and run some simple codes in the link I provided

    – Pengfei Li
    Nov 13 '18 at 16:07












  • You need to prove that all the advice in that link does not apply here. What versions are you trying to use? Have you proven the assertion that the version(s) you think you have are being used? There is a lot of info in that related link, and it is your responsibility to tell us how none of it applies. The fact is that _obtain_input_shape does not exist in your version of this dependency, and this is required to import the dependency. Find out why.

    – jdv
    Nov 13 '18 at 16:10












  • I modified my questions. Hope it makes sense now.

    – Pengfei Li
    Nov 13 '18 at 16:12
















What research have you done? Show what steps you have taken to solve this in the question with an edit. For example, how is stackoverflow.com/q/49113140/1531971 not a duplicate issue?

– jdv
Nov 13 '18 at 16:00






What research have you done? Show what steps you have taken to solve this in the question with an edit. For example, how is stackoverflow.com/q/49113140/1531971 not a duplicate issue?

– jdv
Nov 13 '18 at 16:00














It is not a duplicate. I did not run "from keras.applications.imagenet_utils import _obtain_input_shape", I just tried to study the package and run some simple codes in the link I provided

– Pengfei Li
Nov 13 '18 at 16:07






It is not a duplicate. I did not run "from keras.applications.imagenet_utils import _obtain_input_shape", I just tried to study the package and run some simple codes in the link I provided

– Pengfei Li
Nov 13 '18 at 16:07














You need to prove that all the advice in that link does not apply here. What versions are you trying to use? Have you proven the assertion that the version(s) you think you have are being used? There is a lot of info in that related link, and it is your responsibility to tell us how none of it applies. The fact is that _obtain_input_shape does not exist in your version of this dependency, and this is required to import the dependency. Find out why.

– jdv
Nov 13 '18 at 16:10






You need to prove that all the advice in that link does not apply here. What versions are you trying to use? Have you proven the assertion that the version(s) you think you have are being used? There is a lot of info in that related link, and it is your responsibility to tell us how none of it applies. The fact is that _obtain_input_shape does not exist in your version of this dependency, and this is required to import the dependency. Find out why.

– jdv
Nov 13 '18 at 16:10














I modified my questions. Hope it makes sense now.

– Pengfei Li
Nov 13 '18 at 16:12





I modified my questions. Hope it makes sense now.

– Pengfei Li
Nov 13 '18 at 16:12












1 Answer
1






active

oldest

votes


















0














The VGGFace package you're using is configured for an older version of Keras. The easiest solution for you is to edit the keras-vggface/keras_vggface/models.py file inside the vvgface directory and change line 15 from:



from keras.applications.imagenet_utils import _obtain_input_shape



to



from keras_applications.imagenet_utils import _obtain_input_shape



Alternatively you can also just downgrade Keras to 2.2.0 if you find that easier






share|improve this answer























  • Same answer as stackoverflow.com/a/52101454/1531971 I think...

    – jdv
    Nov 13 '18 at 16:16











  • Okay. It seems I have to do this.

    – Pengfei Li
    Nov 13 '18 at 16:17


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The VGGFace package you're using is configured for an older version of Keras. The easiest solution for you is to edit the keras-vggface/keras_vggface/models.py file inside the vvgface directory and change line 15 from:



from keras.applications.imagenet_utils import _obtain_input_shape



to



from keras_applications.imagenet_utils import _obtain_input_shape



Alternatively you can also just downgrade Keras to 2.2.0 if you find that easier






share|improve this answer























  • Same answer as stackoverflow.com/a/52101454/1531971 I think...

    – jdv
    Nov 13 '18 at 16:16











  • Okay. It seems I have to do this.

    – Pengfei Li
    Nov 13 '18 at 16:17
















0














The VGGFace package you're using is configured for an older version of Keras. The easiest solution for you is to edit the keras-vggface/keras_vggface/models.py file inside the vvgface directory and change line 15 from:



from keras.applications.imagenet_utils import _obtain_input_shape



to



from keras_applications.imagenet_utils import _obtain_input_shape



Alternatively you can also just downgrade Keras to 2.2.0 if you find that easier






share|improve this answer























  • Same answer as stackoverflow.com/a/52101454/1531971 I think...

    – jdv
    Nov 13 '18 at 16:16











  • Okay. It seems I have to do this.

    – Pengfei Li
    Nov 13 '18 at 16:17














0












0








0







The VGGFace package you're using is configured for an older version of Keras. The easiest solution for you is to edit the keras-vggface/keras_vggface/models.py file inside the vvgface directory and change line 15 from:



from keras.applications.imagenet_utils import _obtain_input_shape



to



from keras_applications.imagenet_utils import _obtain_input_shape



Alternatively you can also just downgrade Keras to 2.2.0 if you find that easier






share|improve this answer













The VGGFace package you're using is configured for an older version of Keras. The easiest solution for you is to edit the keras-vggface/keras_vggface/models.py file inside the vvgface directory and change line 15 from:



from keras.applications.imagenet_utils import _obtain_input_shape



to



from keras_applications.imagenet_utils import _obtain_input_shape



Alternatively you can also just downgrade Keras to 2.2.0 if you find that easier







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 16:14









Tadej MagajnaTadej Magajna

1,1201232




1,1201232












  • Same answer as stackoverflow.com/a/52101454/1531971 I think...

    – jdv
    Nov 13 '18 at 16:16











  • Okay. It seems I have to do this.

    – Pengfei Li
    Nov 13 '18 at 16:17


















  • Same answer as stackoverflow.com/a/52101454/1531971 I think...

    – jdv
    Nov 13 '18 at 16:16











  • Okay. It seems I have to do this.

    – Pengfei Li
    Nov 13 '18 at 16:17

















Same answer as stackoverflow.com/a/52101454/1531971 I think...

– jdv
Nov 13 '18 at 16:16





Same answer as stackoverflow.com/a/52101454/1531971 I think...

– jdv
Nov 13 '18 at 16:16













Okay. It seems I have to do this.

– Pengfei Li
Nov 13 '18 at 16:17






Okay. It seems I have to do this.

– Pengfei Li
Nov 13 '18 at 16:17




這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3