decord icon indicating copy to clipboard operation
decord copied to clipboard

Error when trying to use shuffle=3

Open eawer opened this issue 5 years ago • 1 comments

Greetings! Decord version is '0.4.0'

Here is my code:

vl = VideoLoader(videos, ctx=[cpu(0)], shape=(10, 1280, 720, 3), interval=1, skip=5, shuffle=3)

And here is my error:

DECORDErrorTraceback (most recent call last)
<timed exec> in <module>

/opt/conda/lib/python3.6/site-packages/decord/video_loader.py in __init__(self, uris, ctx, shape, interval, skip, shuffle, prefetch)
     53         assert len(shape) == 4, "expected shape: [bs, height, width, 3], given {}".format(shape)
     54         self._handle = _CAPI_VideoLoaderGetVideoLoader(
---> 55             uri, device_types, device_ids, shape[0], shape[1], shape[2], shape[3], interval, skip, shuffle, prefetch)
     56         assert self._handle is not None
     57         self._len = _CAPI_VideoLoaderLength(self._handle)

/opt/conda/lib/python3.6/site-packages/decord/_ffi/_ctypes/function.py in __call__(self, *args)
    173         check_call(_LIB.DECORDFuncCall(
    174             self.handle, values, tcodes, ctypes.c_int(num_args),
--> 175             ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
    176         _ = temp_args
    177         _ = args

/opt/conda/lib/python3.6/site-packages/decord/_ffi/base.py in check_call(ret)
     61     """
     62     if ret != 0:
---> 63         raise DECORDError(py_str(_LIB.DECORDGetLastError()))
     64 
     65 

DECORDError: [08:51:44] /io/decord/src/video/video_loader.cc:70: Invalid shuffle mode: 3 Available: 
	{No shuffle: 0}
	{Random File Order: 1}
	{Random access: 2}

Stack trace returned 10 entries:
[bt] (0) /opt/conda/lib/python3.6/site-packages/decord/libdecord.so(dmlc::StackTrace(unsigned long)+0x50) [0x7f3ea0501830]
[bt] (1) /opt/conda/lib/python3.6/site-packages/decord/libdecord.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x1d) [0x7f3ea050291d]
[bt] (2) /opt/conda/lib/python3.6/site-packages/decord/libdecord.so(decord::VideoLoader::VideoLoader(std::vector<std::string, std::allocator<std::string> >, std::vector<DLContext, std::allocator<DLContext> >, std::vector<int, std::allocator<int> >, int, int, int, int)+0xe54) [0x7f3ea054c4c4]
[bt] (3) /opt/conda/lib/python3.6/site-packages/decord/libdecord.so(+0x6d5be) [0x7f3ea05455be]
[bt] (4) /opt/conda/lib/python3.6/site-packages/decord/libdecord.so(DECORDFuncCall+0x52) [0x7f3ea04fe412]
[bt] (5) /opt/conda/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f3ebcce7ec0]
[bt] (6) /opt/conda/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f3ebcce787d]
[bt] (7) /opt/conda/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce) [0x7f3ebcefdede]
[bt] (8) /opt/conda/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(+0x13915) [0x7f3ebcefe915]
[bt] (9) /opt/conda/bin/python(_PyObject_FastCallDict+0x8b) [0x561e814a1e3b]

How can I use shuffle=3 on video batches? Do I understand right, that shuffle=3 will give me BATCH_SIZe number of random frames from the each video? If it's right, why do we need interval and skip in this mode?

Thanks in advance!

eawer avatar Jul 15 '20 08:07 eawer

I have the same problem:

  • shuffle=3 is not working
  • I don't understand why we need skip and interval parameters when using an intra-batch shuffle mode (mode 2 or 3)

Right now I want frames to be shuffled, but I want to see all of them, so I specify skip and interval to 0, but all batches returned by VideoLoader are the same

francoisruty avatar Aug 17 '20 09:08 francoisruty