Coder Social home page Coder Social logo

hikapok / tf-senet Goto Github PK

View Code? Open in Web Editor NEW
53.0 53.0 26.0 24 KB

SE_ResNet && SE_ResNeXt with pretrained weights on ImageNet (SENet In TensorFlow)

License: Apache License 2.0

Python 100.00%
resnet resnext senet seresnet seresnext tensorflow weights

tf-senet's People

Contributors

hikapok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tf-senet's Issues

I have one issue, when i train model. Key conv1/7x7_s2/bn/beta/Momentum not found in checkpoint is not found.

tensorflow.python.framework.errors_impl.NotFoundError: Key conv1/7x7_s2/bn/beta/Momentum not found in checkpoint │·············································
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/│·············································
Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]] │·············································
[[Node: save/RestoreV2/_301 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_│·············································
name="edge_306_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"
]] │·············································
│·············································
Caused by op 'save/RestoreV2', defined at: │·············································
File "SE_resnext.py", line 272, in │·············································
saver = tf.train.Saver(tf.global_variables()) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1311, in init │·············································
self.build() │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1320, in build │·············································
self._build(self._filename, build_save=True, build_restore=True) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1357, in _build │·············································
build_save=build_save, build_restore=build_restore) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 809, in _build_internal │·············································
restore_sequentially, reshape) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 448, in _AddRestoreOps │·············································
restore_sequentially) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 860, in bulk_restore │·············································
return io_ops.restore_v2(filename_tensor, names, slices, dtypes) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1458, in restore_v2 │·············································
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper │·············································
op_def=op_def) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3290, in create_op │·············································
op_def=op_def) │·············································
File "/vol/venvs/tf1.7/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1654, in init │·············································
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access │·············································
│·············································
NotFoundError (see above for traceback): Key conv1/7x7_s2/bn/beta/Momentum not found in checkpoint │·············································
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/│·············································
Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]] │·············································
[[Node: save/RestoreV2/_301 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_│·············································
name="edge_306_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"
]]

image preprocesing

about the image preprocessing, i did not get your point, can you tell more details

How to classify an image?

I want to classify an image, but the result is not correct. What is wrong with the operation?

input_image = tf.placeholder(tf.float32,  shape=(None, 3, 224, 224), name='input_placeholder')
outputs = SE_ResNet(input_image, 1000, is_training=False, data_format='channels_first')

saver = tf.train.Saver()

with tf.Session() as sess:
    init = tf.global_variables_initializer()
    sess.run(init)

    saver.restore(sess, "./seresnet50/se_resnet50.ckpt")
    img = cv2.imread('./person.jpg')
    img = cv2.resize(img, (224, 224))
    img = np.array(img, np.float32)
    img -= np.array([[[104., 117., 123.]]])
    img = np.transpose(img, (2, 0, 1))

    predict = sess.run(outputs, feed_dict={input_image: np.expand_dims(img, axis=0)})
    print(predict)
print(np.argmax(predict))

@HiKapok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.