Is based on a data input , however, continue to look at the model input data you will encounter a variety of data structures, such as iterators yield
This article will continue to get to the bottom to see how audio input and rgb features, then get NeXtVLAD features of the cluster.
I looked at the output of the model, it can only output class, and I want to get a certain level of output. This Zezheng it? ?
Fart big point thing I trouble Baidu result of a lot of people to help me, really hard, never again to say bad things about flying pulp, ha ha.
I think you have to use a sledgehammer to kill a chicken, quick! Own blind groping for a long time or even longer really a waste of time.
After I have a problem or make the whole world to know that I appreciate all the help of big brother.
The output of the model layer, and a method of loading the model directly see below. Could it be that there is no GPU would not do it? ? ?
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 783, in run
six.reraise(*sys.exc_info())
File "D:\python36\lib\site-packages\six.py", line 703, in reraise
raise value
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 778, in run
use_program_cache=use_program_cache)
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 831, in _run_impl
use_program_cache=use_program_cache)
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 851, in _run_program
assert len(feed) == 1, "Not compiled with data parallel"
AssertionError: Not compiled with data parallel
But I use GPU also get the same result in the server, FML, which is wisdom, then one would not become a tensor fly pulp, I changed tensor it?
Flying into a pulp tensor does not work, the following must be entered in the format, FML, which is strange. Here I dissected this function in the end is hell.
feed=infer_feeder.feed(data_feed_in))
The following interpretation I thought it was a set list to:
>>> for infer_iter, data in enumerate(infer_reader()):
print(infer_iter,data.shape)
Traceback (most recent call last):
File "<pyshell#2>", line 2, in <module>
print(infer_iter,data.shape)
AttributeError: 'list' object has no attribute 'shape'
>>> for infer_iter, data in enumerate(infer_reader()):
print(infer_iter,len(data))
0 1
>>> for infer_iter, data in enumerate(infer_reader()):
print(infer_iter,len(data[0]))
0 2
>>> for infer_iter, data in enumerate(infer_reader()):
print(infer_iter,data[0][0].shape[0])
0 3
>>> for infer_iter, data in enumerate(infer_reader()):
print(infer_iter,data[0][0].shape)
0 (3, 1024)
>>> for infer_iter, data in enumerate(infer_reader()):
print(infer_iter,data[0][1].shape)
0 (3, 128)
>>> data_feed_in = [items for items in data]
>>> data_feed_in==data
True
Later I discovered that there are still problems infer_feeder of:
Warning (from warnings module):
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 782
"The following exception is not an EOF exception.")
UserWarning: The following exception is not an EOF exception.
Traceback (most recent call last):
File "D:/python36/new/rcdnn/image/my_predict_2.py", line 123, in <module>
feed=[[image_feature,audio_feature]])#feed=infer_feeder.feed(data_feed_in))
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 783, in run
six.reraise(*sys.exc_info())
File "D:\python36\lib\site-packages\six.py", line 703, in reraise
raise value
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 778, in run
use_program_cache=use_program_cache)
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 831, in _run_impl
use_program_cache=use_program_cache)
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 857, in _run_program
(type(feed)))
TypeError: feed requires dict as its Parameter. But you passed in <class 'list'>
People say to dict, I gave a list of wrong, oh yes ah, should be a dictionary fishes, try
>>> infer_feeder.feed(data)
{'test_rgb': <paddle.fluid.core_avx.LoDTensor object at 0x000002D8B6262068>, 'test_audio': <paddle.fluid.core_avx.LoDTensor object at 0x000002D8B625DFB8>}
But below or wrong, I went to, have to use infer_feeder ah? ?
Warning (from warnings module):
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 782
"The following exception is not an EOF exception.")
UserWarning: The following exception is not an EOF exception.
Traceback (most recent call last):
File "D:/python36/new/rcdnn/image/my_predict_2.py", line 123, in <module>
feed={'test_rgb':image_feature,'test_audio':audio_feature})#feed=infer_feeder.feed(data_feed_in))
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 783, in run
six.reraise(*sys.exc_info())
File "D:\python36\lib\site-packages\six.py", line 703, in reraise
raise value
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 778, in run
use_program_cache=use_program_cache)
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 831, in _run_impl
use_program_cache=use_program_cache)
File "D:\python36\lib\site-packages\paddle\fluid\executor.py", line 905, in _run_program
fetch_var_name)
paddle.fluid.core_avx.EnforceNotMet:
--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
Windows not support stack backtrace yet.
------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
File "D:\python36\lib\site-packages\paddle\fluid\framework.py", line 2525, in append_op
attrs=kwargs.get("attrs", None))
File "D:\python36\lib\site-packages\paddle\fluid\layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "D:\python36\lib\site-packages\paddle\fluid\layers\sequence_lod.py", line 350, in sequence_pool
"pad_value": pad_value
File "D:/python36/new/rcdnn/image\models\nextvlad\nextvlad_model.py", line 76, in forward
a_sum = fluid.layers.sequence_pool(activation, 'sum')
File "D:/python36/new/rcdnn/image\models\nextvlad\nextvlad_model.py", line 162, in create_model
vlad_video = video_nextvlad.forward(video_input)
File "D:/python36/new/rcdnn/image\models\nextvlad\nextvlad.py", line 117, in build_model
rgb, audio, is_training=(self.mode == 'train'), **model_args)
File "D:/python36/new/rcdnn/image/my_predict_2.py", line 84, in <module>
infer_model.build_model()
File "D:\python36\lib\idlelib\run.py", line 474, in runcode
exec(code, self.locals)
File "D:\python36\lib\idlelib\run.py", line 144, in main
ret = method(*args, **kwargs)
File "<string>", line 1, in <module>
----------------------
Error Message Summary:
----------------------
InvalidArgumentError: Input(X) Tensor of SequencePoolOp does not contain LoD information.
[Hint: Expected lod_level > 0, but received lod_level:0 <= 0:0.] at (D:\1.7.1\paddle\paddle/fluid/operators/sequence_ops/sequence_pool_op.h:43)
[operator < sequence_pool > error]
Add a [] is not enough,
RuntimeError: Some of your feed data hold LoD information.
They can not be completely cast from a list of Python
ndarray to LoDTensor. Please convert data to LoDTensor
directly before feeding the data.
People say you want to fly into pulp tensor, I try numpy gnaw into LoDTensor? ? The results still does not work, Baidu's big brother said numpy to yield returns.
But even if there is no yield Guaren looked important, but there must be data_feeder, which is fed standardized data, not less, this is not easy in tf.
Official Examples:
| import numpy as np
| import paddle.fluid as fluid
|
| def generate_reader(batch_size, base=0, factor=1):
| def _reader():
| for i in range(batch_size):
| yield np.ones([4]) * factor + base, np.ones([4]) * factor + base + 5
| return _reader()
|
| x = fluid.data(name='x', shape=[None, 2, 2])
| y = fluid.data(name='y', shape=[None, 2, 2], dtype='float32')
|
| z = fluid.layers.elementwise_add(x, y)
|
| feeder = fluid.DataFeeder(['x','y'], fluid.CPUPlace())
| place_num = 2
| places = [fluid.CPUPlace() for x in range(place_num)]
| data = []
| exe = fluid.Executor(fluid.CPUPlace())
| exe.run(fluid.default_startup_program())
| program = fluid.CompiledProgram(fluid.default_main_program()).with_data_parallel(places=places)
|
| # print sample feed_parallel r result
| # for item in list(feeder.feed_parallel([generate_reader(5, 0, 1), generate_reader(3, 10, 2)], 2)):
| # print(item['x'])
| # print(item['y'])
|
| reader_list = [generate_reader(5, 0, 1), generate_reader(3, 10, 2)]
| res = exe.run(program=program, feed=list(feeder.feed_parallel(reader_list, 2)), fetch_list=[z])
| print(res)
So I do not change, so be it, ready to write the document.
Another related problem can be added QQ group discussion, no micro-channel group
QQ group: 868 373 192
Voice video image depth - study group