Code Monkey home page Code Monkey logo

skin-segmentation-tensorflow's People

Contributors

hasnainraz 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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skin-segmentation-tensorflow's Issues

tensorflow 1.6 issue

$ ./model.py
Training inititated...
Traceback (most recent call last):
  File "./model.py", line 235, in <module>
    train(image_paths, mask_paths, val_image_paths, val_mask_paths)
  File "./model.py", line 104, in train
    val_image_path, val_mask_path, augment=False, batch_size=3)
  File "/home/ai/Projects/Skin-Segmentation-TensorFlow/utility.py", line 123, in data_batch
    _parse_data, num_parallel_calls=num_threads).prefetch(30)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 792, in map
    return ParallelMapDataset(self, map_func, num_parallel_calls)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1628, in __init__
    super(ParallelMapDataset, self).__init__(input_dataset, map_func)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1597, in __init__
    self._map_func.add_to_graph(ops.get_default_graph())
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/function.py", line 486, in add_to_graph
    self._create_definition_if_needed()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/function.py", line 321, in _create_definition_if_needed
    self._create_definition_if_needed_impl()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/function.py", line 338, in _create_definition_if_needed_impl
    outputs = self._func(*inputs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1560, in tf_map_func
    ret = map_func(*nested_args)
  File "/home/ai/Projects/Skin-Segmentation-TensorFlow/utility.py", line 87, in _parse_data
    image_content = tf.read_file(image_paths)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 382, in read_file
    "ReadFile", filename=filename, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 533, in _apply_op_helper
    (prefix, dtypes.as_dtype(input_arg.type).name))
TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.

train process is too slow

I don't know, maybe I do something wrong but I have GeForce GTX 1080 and see periodicaly used gpu, but not constantly usage and train process is too slow (ofcause with CPU it is tooo slow)

Can you share your results of training? how long does it take? What gpu you use?

hair detect

I have prepared (not big) data set with hair masks by analogy with skin

Tell me please does such a idea make any sense whatsoever?

Problem in training

When I began to train your model, I had this issue, but I have no ideas how to fix it. Could you please help me fix it? Thank you very much

Train loss:  0.0 Train iou:  0.0
Val. loss:  0.6931054 Val. iou:  0.4069072
Starting epoch:  0
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1356, in _do_call
    return fn(*args)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1341, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: 2 root error(s) found.
  (0) Resource exhausted: OOM when allocating tensor with shape[4,256,121,161] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
	 [[{{node up2/conv2d_transpose}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

	 [[iou_metric/confusion_matrix/stack_1/_81]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

  (1) Resource exhausted: OOM when allocating tensor with shape[4,256,121,161] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
	 [[{{node up2/conv2d_transpose}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "model.py", line 232, in <module>
    train(image_paths, mask_paths, val_image_paths, val_mask_paths)
  File "model.py", line 156, in train
    [train, cost, iou_update, seg_image], feed_dict=train_feed_dict)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 950, in run
    run_metadata_ptr)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1173, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1350, in _do_run
    run_metadata)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1370, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: 2 root error(s) found.
  (0) Resource exhausted: OOM when allocating tensor with shape[4,256,121,161] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
	 [[node up2/conv2d_transpose (defined at /tmp/tmpwtsgo0a_.py:68) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

	 [[iou_metric/confusion_matrix/stack_1/_81]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

  (1) Resource exhausted: OOM when allocating tensor with shape[4,256,121,161] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
	 [[node up2/conv2d_transpose (defined at /tmp/tmpwtsgo0a_.py:68) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

0 successful operations.
0 derived errors ignored.

Errors may have originated from an input operation.
Input Source operations connected to node up2/conv2d_transpose:
 up2/stack (defined at /tmp/tmpwtsgo0a_.py:67)	
 batch_normalization_9/cond/Merge (defined at /tmp/tmp5xi7m83o.py:14)	
 up2/kernel/read (defined at model.py:33)

Input Source operations connected to node up2/conv2d_transpose:
 up2/stack (defined at /tmp/tmpwtsgo0a_.py:67)	
 batch_normalization_9/cond/Merge (defined at /tmp/tmp5xi7m83o.py:14)	
 up2/kernel/read (defined at model.py:33)

Original stack trace for 'up2/conv2d_transpose':
  File "model.py", line 232, in <module>
    train(image_paths, mask_paths, val_image_paths, val_mask_paths)
  File "model.py", line 114, in train
    logits = inference(image_placeholder, training_flag)
  File "model.py", line 79, in inference
    up2 = trans_conv_with_bn(unconv3, 256, [3, 3], is_training, name='up2')
  File "model.py", line 33, in trans_conv_with_bn
    use_bias=use_bias, kernel_initializer=tf.contrib.layers.xavier_initializer(), name=name)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/layers/convolutional.py", line 1279, in conv2d_transpose
    return layer.apply(inputs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1479, in apply
    return self.__call__(inputs, *args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/layers/base.py", line 537, in __call__
    outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 634, in __call__
    outputs = call_fn(inputs, *args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 146, in wrapper
    ), args, kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 450, in converted_call
    result = converted_f(*effective_args, **kwargs)
  File "/tmp/tmpwtsgo0a_.py", line 68, in tf__call
    outputs = ag__.converted_call('conv2d_transpose', backend, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (inputs, self.kernel, output_shape_tensor), {'strides': self.strides, 'padding': self.padding, 'data_format': self.data_format, 'dilation_rate': self.dilation_rate})
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 356, in converted_call
    return _call_unconverted(f, args, kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 253, in _call_unconverted
    return f(*args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 4582, in conv2d_transpose
    data_format=tf_data_format)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/ops/nn_ops.py", line 2147, in conv2d_transpose
    name=name)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/ops/nn_ops.py", line 2218, in conv2d_transpose_v2
    name=name)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 1407, in conv2d_backprop_input
    name=name)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
    op_def=op_def)
  File "/home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 2005, in __init__
    self._traceback = tf_stack.extract_stack()

"InvalidArgumentError: assertion failed", any solution for this issue?

...
line 1291, in _do_call
raise type(e)(node_def, op, message)

InvalidArgumentError: assertion failed: [Need value.shape >= size, got ] [640 427 3] [408 544 3]
[[Node: cond/random_crop/Assert/Assert = Assert[T=[DT_STRING, DT_INT32, DT_INT32], summarize=1000](cond/random_crop/All, cond/random_crop/Assert/Assert/data_0, cond/random_crop/Shape, cond/random_crop/size)]]
[[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[[?,480,640,3], [?,480,640,1]], output_types=[DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

tensorflow version

Hi! Thank you so much for your amazing work. May I ask what kind of TensorFlow version are you using? I got so many errors from TensorFlow. Would you please double-check that? Thanks!

train guide

Hello!

Can you show how you prepare data to train?

NotFoundError: NewRandomAccessFile failed to Create/Open

NotFoundError: NewRandomAccessFile failed to Create/Open: C:/Users/HP/Desktop/.............\mask-newfamily-08.png : The system cannot find the file specified.
; No such file or directory
[[{{node ReadFile_1}}]]
[[{{node IteratorGetNext}}]]

I am getting this error fro every image in train and test folders while running the code. Even though the images are present on the mentioned path but unable to find the reason for the same.

tensorflow error

data = tf.data.Dataset.from_tensor_slices(

AttributeError: module 'tensorflow' has no attribute 'data'

at the end of train

('Step:', 9998)
('Step:', 9999)
2018-03-21 22:20:25.266267: W tensorflow/core/framework/op_kernel.cc:1202] OP_REQUIRES failed at iterator_ops.cc:870 : Invalid argument: Cannot batch tensors with different shapes in component 0. First element had shape [640,427,3] and element 1 had shape [1600,1067,3].
Traceback (most recent call last):
  File "./model.py", line 235, in <module>
    train(image_paths, mask_paths, val_image_paths, val_mask_paths)
  File "./model.py", line 169, in train
    [val_image_tensor, val_mask_tensor])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 905, in run
    run_metadata_ptr)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1137, in _run
    feed_dict_tensor, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1355, in _do_run
    options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1374, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot batch tensors with different shapes in component 0. First element had shape [640,427,3] and element 1 had shape [1600,1067,3].
	 [[Node: IteratorGetNext_1 = IteratorGetNext[output_shapes=[[?,480,640,3], [?,480,640,1]], output_types=[DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Iterator_1)]]

Caused by op u'IteratorGetNext_1', defined at:
  File "./model.py", line 235, in <module>
    train(image_paths, mask_paths, val_image_paths, val_mask_paths)
  File "./model.py", line 104, in train
    val_image_path, val_mask_path, augment=False, batch_size=3)
  File "/home/ai/Projects/Skin-Segmentation-TensorFlow/utility.py", line 158, in data_batch
    next_element = iterator.get_next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/data/ops/iterator_ops.py", line 330, in get_next
    name=name)), self._output_types,
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_dataset_ops.py", line 866, in iterator_get_next
    output_shapes=output_shapes, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3271, in create_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1650, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Cannot batch tensors with different shapes in component 0. First element had shape [640,427,3] and element 1 had shape [1600,1067,3].
	 [[Node: IteratorGetNext_1 = IteratorGetNext[output_shapes=[[?,480,640,3], [?,480,640,1]], output_types=[DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Iterator_1)]]

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.