juglab / cryoCARE_pip

PIP package of cryoCARE
BSD 3-Clause "New" or "Revised" License
25 stars 14 forks source link

assert even.data.shape[0] > 2 * sample_shape[0] error #36

Closed zehrea closed 1 year ago

zehrea commented 1 year ago

Hello,

I reconstructed even and odd tomograms with IMOD's 4.12 alttomosetup. I am getting the error below. What is this error?

cryoCARE_extract_train_data.py --conf train_data_config.json /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) Traceback (most recent call last): File "/usr/local/apps/cryocare_pip/conda/envs/cryocare/bin/cryoCARE_extract_train_data.py", line 33, in main() File "/usr/local/apps/cryocare_pip/conda/envs/cryocare/bin/cryoCARE_extract_train_data.py", line 27, in main tilt_axis=config['tilt_axis'], n_normalization_samples=config['n_normalization_samples']) File "/usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/cryocare/internals/CryoCAREDataModule.py", line 173, in setup validation_fraction=validation_fraction) File "/usr/local/apps/cryocare_pip/conda/envs/cryocare/lib/python3.7/site-packages/cryocare/internals/CryoCAREDataModule.py", line 210, in compute_extraction_shapes assert even.data.shape[0] > 2 * sample_shape[0] AssertionError

Thanks, Elena

zehrea commented 1 year ago

I resolved the issue

Elena

thorstenwagner commented 1 year ago

Thanks for letting us know.

nadavelad commented 1 year ago

Hi Elena I have the same issue. Can you please let me know how you resolved it Thanks Nadav

zehrea commented 1 year ago

Hi Nadav,

During etomo reconstruction, I used a positioning step to set the

thickness, same would be if one uses "calculated thickness". This was giving me an error, because both of these would be subject to differences between the data giving different thicknesses. You would need to set the thickness explicitly to a fixed value.

However, the proper way to generate even/odd tomos would be to use the program alttomosetup (in IMOD 4.12) with the -evenodd option

Thanks, Elena

On Wed, Mar 8, 2023 at 10:00 AM nadavelad @.***> wrote:

Hi Elena I have the same issue. Can you please let me know how you resolved it Thanks Nadav

— Reply to this email directly, view it on GitHub https://github.com/juglab/cryoCARE_pip/issues/36#issuecomment-1460292489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMOKHKYSP4AC6RXNMRKJVVDW3CNJXANCNFSM6AAAAAARB2PEUQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Elena

nadavelad commented 1 year ago

Hi Elena, Thank you for your reply. The thickness of my volumes is identical, this was not the source of the problem. The problem was that the volume was too small in the Z dimension. As far as I understand, the script tests that the size of the patch_shape is smaller than half the volume in all dimensions, and if it is too big it raises this AssertionError. Nadav

Amy1809 commented 1 week ago

Hi Elena, Thank you for your reply. The thickness of my volumes is identical, this was not the source of the problem. The problem was that the volume was too small in the Z dimension. As far as I understand, the script tests that the size of the patch_shape is smaller than half the volume in all dimensions, and if it is too big it raises this AssertionError. Nadav

Hi Nadav, The Z dimension of my tomogram is 1200, and the patch_shape is [72, 72, 72] in my training script. This gives me an assertion error, do you know why?