Giter Site home page Giter Site logo

tf2-mycnn's Introduction

👋 Hi there, I'm Jacky

I like to write Python code and and exploring new technology 😄

Currently learning about artificial intelligent, 3D image processing, web development🌱

Anurag's GitHub statsTop Langs

🛠️ Languages and Tools:

tf2-mycnn's People

Contributors

jacky10001 avatar

Watchers

 avatar

tf2-mycnn's Issues

`generate_classification_dataset` 執行錯誤

錯誤訊息:

TypeError: in user code:

    e:\YJ\tf2-mycnn-main\mycnn\data\classification.py:189 None  *
        lambda x: load_img(x, "train")
    e:\YJ\tf2-mycnn-main\mycnn\data\classification.py:134 load_img  *
        x = tf.cond(
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\util\dispatch.py:201 wrapper  **
        return target(*args, **kwargs)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\control_flow_ops.py:1396 cond_for_tf_v2
        return cond(pred, true_fn=true_fn, false_fn=false_fn, strict=True, name=name)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\util\dispatch.py:201 wrapper
        return target(*args, **kwargs)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\util\deprecation.py:538 new_func
        return func(*args, **kwargs)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\control_flow_ops.py:1180 cond
        return cond_v2.cond_v2(pred, true_fn, false_fn, name)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\cond_v2.py:99 cond_v2
        return _build_cond(
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\cond_v2.py:257 _build_cond
        _check_same_outputs(_COND, [true_graph, false_graph])
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\cond_v2.py:839 _check_same_outputs
        error(b, "%s and %s have different types" % (b0_out, bn_out))
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\cond_v2.py:802 error
        raise TypeError(

    TypeError: true_fn and false_fn arguments to tf.cond must have the same number, type, and overall structure of return values.
    
    true_fn output: Tensor("cond_4/Identity:0", shape=(227, 227, 3), dtype=float32)
    false_fn output: Tensor("cond_4/Identity:0", shape=(227, 227, 3), dtype=uint8)
    
    Error details:
    Tensor("cond_4/Identity:0", shape=(227, 227, 3), dtype=float32) and Tensor("cond_4/Identity:0", shape=(227, 227, 3), dtype=uint8) have different types

FCN 長時間訓練出現錯誤

ResourceExhaustedError                    Traceback (most recent call last)
<ipython-input-16-9898c6d2bce4> in <module>
----> 1 cnn.train_dataset(train_dataset, valid_dataset)

e:\YJ\tf2-mycnn\mycnn\core\_wrapper.py in wrapper(self, *args, **kwargs)
     26             if not self.training and "training" in state:
     27                 raise NotImplementedError('Not define training parameter, please call `setup_training()` method.')
---> 28             return mth(self, *args, **kwargs)
     29         return wrapper
     30     return decorator

e:\YJ\tf2-mycnn\mycnn\core\base_model.py in train_dataset(self, tra_dataset, val_dataset, last_checkpoint)
    307                      epochs=self.__cfg['epochs'],
    308                      initial_epoch=self.__cfg['initial_epoch'],
--> 309                      callbacks=self.__cbks_list)
    310 
    311     @check_state("built")

C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
   1098                 _r=1):
   1099               callbacks.on_train_batch_begin(step)
-> 1100               tmp_logs = self.train_function(iterator)
   1101               if data_handler.should_sync:
   1102                 context.async_wait()

C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\eager\def_function.py in __call__(self, *args, **kwds)
    826     tracing_count = self.experimental_get_tracing_count()
    827     with trace.Trace(self._name) as tm:
--> 828       result = self._call(*args, **kwds)
    829       compiler = "xla" if self._experimental_compile else "nonXla"
    830       new_tracing_count = self.experimental_get_tracing_count()

C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\eager\def_function.py in _call(self, *args, **kwds)
    853       # In this case we have created variables on the first call, so we run the
    854       # defunned version which is guaranteed to never create variables.
--> 855       return self._stateless_fn(*args, **kwds)  # pylint: disable=not-callable
    856     elif self._stateful_fn is not None:
    857       # Release the lock early so that multiple threads can perform the call

C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\eager\function.py in __call__(self, *args, **kwargs)
   2941        filtered_flat_args) = self._maybe_define_function(args, kwargs)
   2942     return graph_function._call_flat(
-> 2943         filtered_flat_args, captured_inputs=graph_function.captured_inputs)  # pylint: disable=protected-access
   2944 
   2945   @property

C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\eager\function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
   1917       # No tape is watching; skip to running the function.
   1918       return self._build_call_outputs(self._inference_function.call(
-> 1919           ctx, args, cancellation_manager=cancellation_manager))
   1920     forward_backward = self._select_forward_and_backward_functions(
   1921         args,

C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\eager\function.py in call(self, ctx, args, cancellation_manager)
    558               inputs=args,
    559               attrs=attrs,
--> 560               ctx=ctx)
    561         else:
    562           outputs = execute.execute_with_cancellation(

C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\eager\execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     58     ctx.ensure_initialized()
     59     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60                                         inputs, attrs, num_outputs)
     61   except core._NotOkStatusException as e:
     62     if name is not None:

ResourceExhaustedError: 2 root error(s) found.
  (0) Resource exhausted:  Failed to allocate memory for the batch of component 1
	 [[node IteratorGetNext (defined at e:\YJ\tf2-mycnn\mycnn\core\base_model.py:309) ]]
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:  Failed to allocate memory for the batch of component 1
	 [[node IteratorGetNext (defined at e:\YJ\tf2-mycnn\mycnn\core\base_model.py:309) ]]
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.

	 [[IteratorGetNext/_7]]
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. [Op:__inference_train_function_54100]

Function call stack:
train_function -> train_function

MSCenter 貓狗資料在訓練階段讀取錯誤

InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument:  Number of channels inherent in the image must be 1, 3 or 4, was 2
	 [[{{node decode_image/DecodeImage}}]]
	 [[IteratorGetNext]]
  (1) Invalid argument:  Number of channels inherent in the image must be 1, 3 or 4, was 2
	 [[{{node decode_image/DecodeImage}}]]
	 [[IteratorGetNext]]
	 [[IteratorGetNext/_4]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_1618]

Function call stack:
train_function -> train_function

MSCenter 貓狗資料訓練錯誤

InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument:  Input size should match (header_size + row_size * abs_height) but they differ by 2
	 [[{{node decode_image/DecodeImage}}]]
	 [[IteratorGetNext]]
  (1) Invalid argument:  Input size should match (header_size + row_size * abs_height) but they differ by 2
	 [[{{node decode_image/DecodeImage}}]]
	 [[IteratorGetNext]]
	 [[IteratorGetNext/_2]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_1618]

Function call stack:
train_function -> train_function

從MSCenter下載的貓狗資料集含有無效檔案,導致訓練中斷

InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument:  Unknown image file format. One of JPEG, PNG, GIF, BMP required.
	 [[{{node decode_image/DecodeImage}}]]
	 [[IteratorGetNext]]
	 [[IteratorGetNext/_2]]
  (1) Invalid argument:  Unknown image file format. One of JPEG, PNG, GIF, BMP required.
	 [[{{node decode_image/DecodeImage}}]]
	 [[IteratorGetNext]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_1618]

Function call stack:
train_function -> train_function

ValueError in `mycnn.losses.DiceLoss`

ValueError: in user code:

    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\keras\engine\training.py:805 train_function  *
        return step_function(self, iterator)
    e:\YJ\tf2-mycnn\mycnn\losses\dice_loss.py:12 DiceLoss  *
        intersection = K.sum(K.dot(targets, inputs))
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\util\dispatch.py:201 wrapper  **
        return target(*args, **kwargs)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\keras\backend.py:1898 dot
        out = math_ops.matmul(x, y)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\util\dispatch.py:201 wrapper
        return target(*args, **kwargs)
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\math_ops.py:3314 matmul
        return gen_math_ops.mat_mul(
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\ops\gen_math_ops.py:5547 mat_mul
        _, _, _op, _outputs = _op_def_library._apply_op_helper(
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\op_def_library.py:748 _apply_op_helper
        op = g._create_op_internal(op_type_name, inputs, dtypes=None,
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\func_graph.py:590 _create_op_internal
        return super(FuncGraph, self)._create_op_internal(  # pylint: disable=protected-access
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\ops.py:3528 _create_op_internal
        ret = Operation(
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\ops.py:2015 __init__
        self._c_op = _create_c_op(self._graph, node_def, inputs,
    C:\Anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\ops.py:1856 _create_c_op
        raise ValueError(str(e))

    ValueError: Shape must be rank 2 but is rank 1 for '{{node DiceLoss/MatMul}} = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false](DiceLoss/Reshape_1, DiceLoss/Reshape)' with input shapes: [?], [?].

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.