-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix quality issues #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've some doubts regarding this change. See my comment :-)
@@ -211,7 +211,7 @@ def __compute_extraction_shapes__(self, even_path, odd_path, tilt_axis_index, sa | |||
assert even.data.shape[1] > 2 * sample_shape[1] | |||
assert even.data.shape[2] > 2 * sample_shape[2] | |||
|
|||
val_cut_off = int(even.data.shape[tilt_axis_index] * validation_fraction) | |||
val_cut_off = int(even.data.shape[tilt_axis_index] * (1 - validation_fraction)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this is correct.
In cryoCARE_extract_train the validation fraction is already defined as:
validation_fraction=(1.0 - config['split'])
Given a split of 0.9: With your change 90% of the data would be validation data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here
extraction_shape_train[tilt_axis_index] = [0, val_cut_off] |
val_cut_off
. Maybe I am confusing it :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are totally right :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Please merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't manage to run it yet. Secretly hoping that @rdrighetto finds the time 😇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I tested it and now I get this error:
2022-10-05 15:28:10.372969: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
0%| | 0/500 [00:04<?, ?it/s]
Traceback (most recent call last):
File "/scicore/home/engel0006/GROUP/pool-engel/soft/cryo-care/cryoCARE_pip/cryocare_11/bin/cryoCARE_extract_train_data.py", line 45, in <module>
main()
File "/scicore/home/engel0006/GROUP/pool-engel/soft/cryo-care/cryoCARE_pip/cryocare_11/bin/cryoCARE_extract_train_data.py", line 27, in main
dm.setup(config['odd'], config['even'], n_samples_per_tomo=config['num_slices'],
File "/scicore/home/engel0006/GROUP/pool-engel/soft/cryo-care/cryoCARE_pip/cryocare_11/lib/python3.8/site-packages/cryocare/internals/CryoCAREDataModule.py", line 194, in setup
self.train_dataset = CryoCARE_Dataset(tomo_paths_odd=tomo_paths_odd,
File "/scicore/home/engel0006/GROUP/pool-engel/soft/cryo-care/cryoCARE_pip/cryocare_11/lib/python3.8/site-packages/cryocare/internals/CryoCAREDataModule.py", line 46, in __init__
self.compute_mean_std(n_samples=n_normalization_samples)
File "/scicore/home/engel0006/GROUP/pool-engel/soft/cryo-care/cryoCARE_pip/cryocare_11/lib/python3.8/site-packages/cryocare/internals/CryoCAREDataModule.py", line 91, in compute_mean_std
x, _ = self.__getitem__(i)
File "/scicore/home/engel0006/GROUP/pool-engel/soft/cryo-care/cryoCARE_pip/cryocare_11/lib/python3.8/site-packages/cryocare/internals/CryoCAREDataModule.py", line 161, in __getitem__
return self.augment(np.array(even_subvolume)[..., np.newaxis], np.array(odd_subvolume)[..., np.newaxis])
File "/scicore/home/engel0006/GROUP/pool-engel/soft/cryo-care/cryoCARE_pip/cryocare_11/lib/python3.8/site-packages/cryocare/internals/CryoCAREDataModule.py", line 137, in augment
x[i] = np.rot90(x[i], k=rot_k[i], axes=self.rot_axes)
ValueError: could not broadcast input array from shape (1,72,72) into shape (72,72,1)
I tried to fix it by myself without success
- The problem occurs because
x
andy
have shape(72, 72, 72, 1)
whenaugment()
is called - Therefore, when
k=rot_k[i]
is1
or3
innp.rot90
(i.e. a rotation of 90 or 270 degrees) the resulting array will be of shape(1,72,72)
which it will try to put in an array whose original shape is(72,72,1)
(i.e.x[i]
)
As I said, I tried to fix this by getting rid of this 4th dimension within augment()
and placing it back when returning from that function, but then the code would break somewhere else, so I decided it's better to stop and call the experts 😅
Thanks again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I pushed a hot-fix.
I promise, if it does not work this time I will setup everything on my end and stop coding in the github IDE!
Okay, as promised I checked it out and took it for a functional test-run on my side. Now it should work. @rdrighetto could you restart with the current version? I would be interested to see if the results look now better. Thanks! |
I might have found two issues related to the quality drop described in #30.