Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'Toolbox' #1

Open
Shanyaodedanshen opened this issue Jan 8, 2020 · 4 comments
Open

No module named 'Toolbox' #1

Shanyaodedanshen opened this issue Jan 8, 2020 · 4 comments

Comments

@Shanyaodedanshen
Copy link

File "D:\temp\BS-Nets-master\utility.py", line 5, in
from Toolbox.Preprocessing import Processor
ModuleNotFoundError: No module named 'Toolbox'

Could U tell me how to solve it? Thank you.

@AngryCai
Copy link
Owner

AngryCai commented Jan 8, 2020

Change 'from Toolbox.Preprocessing import Processor' to:
from Preprocessing import Processor

@Shanyaodedanshen
Copy link
Author

Thanks.

@Shanyaodedanshen
Copy link
Author

E:\Anaconda\anaconda\python.exe D:/temp/BS-Nets-master/BS_Net_Conv.py
./Dataset/Indian_pines_corrected.mat
img block shape: (16900, 16, 16, 200)
D:/temp/BS-Nets-master/BS_Net_Conv.py:245: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
time_start = time.clock()
2020-01-10 21:53:17.849705: I d:\build\tensorflow\tensorflow-r1.9\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-01-10 21:53:17.855191: I d:\build\tensorflow\tensorflow-r1.9\tensorflow\core\common_runtime\process_util.cc:69] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
Traceback (most recent call last):
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1322, in _do_call
return fn(*args)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Inputs to operation gradients/AddN_16 of type _MklAddN must have the same size and shape. Input 0: [1638400] != input 1: [32,16,16,200]
[[Node: gradients/AddN_16 = _MklAddN[N=2, T=DT_FLOAT, _kernel="MklOp", _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/attention-1/Conv2D_grad/tuple/control_dependency, gradients/mul_grad/tuple/control_dependency_1, gradients/attention-1/Conv2D_grad/tuple/control_dependency:1, gradients/mul_grad/tuple/control_dependency_1:1)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/temp/BS-Nets-master/BS_Net_Conv.py", line 247, in
acnn.fit(img_block, img=X_img, gt=gt, N_BAND=N_BAND)
File "D:/temp/BS-Nets-master/BS_Net_Conv.py", line 119, in fit
train_op.run(feed_dict={self.x_placehoder: x_batch, self.is_training: True})
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 2399, in run
_run_using_default_session(self, feed_dict, self.graph, session)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 5248, in _run_using_default_session
session.run(operation, feed_dict)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Inputs to operation gradients/AddN_16 of type _MklAddN must have the same size and shape. Input 0: [1638400] != input 1: [32,16,16,200]
[[Node: gradients/AddN_16 = _MklAddN[N=2, T=DT_FLOAT, _kernel="MklOp", _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/attention-1/Conv2D_grad/tuple/control_dependency, gradients/mul_grad/tuple/control_dependency_1, gradients/attention-1/Conv2D_grad/tuple/control_dependency:1, gradients/mul_grad/tuple/control_dependency_1:1)]]

Caused by op 'gradients/AddN_16', defined at:
File "D:/temp/BS-Nets-master/BS_Net_Conv.py", line 247, in
acnn.fit(img_block, img=X_img, gt=gt, N_BAND=N_BAND)
File "D:/temp/BS-Nets-master/BS_Net_Conv.py", line 105, in fit
train_op = tf.train.AdamOptimizer(learning_rate=self.lr).minimize(self.loss_recons)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\training\optimizer.py", line 399, in minimize
grad_loss=grad_loss)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\training\optimizer.py", line 511, in compute_gradients
colocate_gradients_with_ops=colocate_gradients_with_ops)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 532, in gradients
gate_gradients, aggregation_method, stop_gradients)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 633, in _GradientsHelper
aggregation_method)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 1005, in _AggregatedGrads
out_grads[i] = _MultiDeviceAddN(out_grad, gradient_uid)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 891, in _MultiDeviceAddN
summands.append(math_ops.add_n(tensors))
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\ops\math_ops.py", line 2125, in add_n
return gen_math_ops.add_n(inputs, name=name)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 368, in add_n
"AddN", inputs=inputs, name=name)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "E:\Anaconda\anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Inputs to operation gradients/AddN_16 of type _MklAddN must have the same size and shape. Input 0: [1638400] != input 1: [32,16,16,200]
[[Node: gradients/AddN_16 = _MklAddN[N=2, T=DT_FLOAT, _kernel="MklOp", _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/attention-1/Conv2D_grad/tuple/control_dependency, gradients/mul_grad/tuple/control_dependency_1, gradients/attention-1/Conv2D_grad/tuple/control_dependency:1, gradients/mul_grad/tuple/control_dependency_1:1)]]
Process finished with exit code 1

Could U help me?

@ucalyptus
Copy link

@Shanyaodedanshen what is ur tf version? Must be above 1.13 .
tf.contrib has been deprecated which is why most functionalities are not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants