self.csv_out[i] = self._initialise_empty_csv(
1 + location_init[0, :].shape[-1])
else:
window[i] = np.asarray(window[i])try:
assert window[i].ndim <= 2
except (TypeError, AssertionError):
tf.logging.error(
"The output you are trying to ""save as csv is more than ""bidimensional. Did you want ""to save an image instead? ""Put the keyword window ""in the output dictionary"" in your application file")
ifwindow[i].ndim < 2:
window[i] = np.expand_dims(window[i], 0)self.csv_out[i] = self._initialise_empty_csv(
n_channel=window[i][0].shape[-1] + location_init
[0, :].shape[-1])
for i in window:
if"window" in i:
self.image_out[i][
x_start:x_end, y_start:y_end, z_start:z_end, ...] = \
window[i][batch_id, ...]
else:
ifisinstance(window[i], (list, tuple, np.ndarray)):
window[i] = np.asarray(window[i])
try:
assert window[i].ndim <= 2
except (TypeError, AssertionError):
tf.logging.error(
"The output you are trying to ""save as csv is more than ""bidimensional. Did you want ""to save an image instead? ""Put the keyword window ""in the output dictionary"" in your application file")
if window[i].ndim < 2:
window[i] = np.expand_dims(window[i], 0)
window[i] = np.asarray(window[i])
window_loc = np.concatenate([
window[i], np.tile(
location_init[batch_id, ...],
[window[i].shape[0], 1])], 1)
else:
window_loc = np.concatenate([
np.reshape(window[i], [1, 1]), np.tile(
location_init[batch_id, ...], [1, 1])], 1)
self.csv_out[i] = np.concatenate([self.csv_out[i],
window_loc], 0)
return True
After Change
self.csv_out[i] = self._initialise_empty_csv(
1 + location_init[0, :].shape[-1])
else:
window_save = np.asarray(np.squeeze(window[i][
batch_id,
...]))try:
assert window_save.ndim <= 2
except (TypeError, AssertionError):
tf.logging.error(
"The output you are trying to ""save as csv is more than ""bidimensional. Did you want ""to save an image instead? ""Put the keyword window ""in the output dictionary"" in your application file")
ifwindow_save.ndim < 2:
window_save = np.expand_dims(window_save, 0)self.csv_out[i] = self._initialise_empty_csv(
n_channel=window_save.shape[-1] +
location_init
[0, :].shape[-1])
for i in window:
if"window" in i:
self.image_out[i][
x_start:x_end, y_start:y_end, z_start:z_end, ...] = \
window[i][batch_id, ...]
else:
ifisinstance(window[i], (list, tuple, np.ndarray)):
window_save = np.squeeze(np.asarray(window[i][batch_id,
...]))
try:
assert window_save.ndim <= 2
except (TypeError, AssertionError):
tf.logging.error(
"The output you are trying to ""save as csv is more than ""bidimensional. Did you want ""to save an image instead? ""Put the keyword window ""in the output dictionary"" in your application file")
while window_save.ndim < 2:
window_save = np.expand_dims(window_save, 0)
window_save = np.asarray(window_save)
window_loc = np.concatenate([
window_save, np.tile(
location_init[batch_id, ...],
[window_save.shape[0], 1])], 1)
else:
window_loc = np.concatenate([
np.reshape(window[i][batch_id, ...], [1, 1]), \
np.tile(
location_init[batch_id, ...], [1, 1])], 1)
self.csv_out[i] = np.concatenate([self.csv_out[i],
window_loc], 0)
return True