Open chappy0205 opened 3 years ago
I can't see all of the code in question, but there seems to be an error because of the differences here.
<ipython-input-13-d6d29bfe65b7>:16 image_preprocess_with_augment *
image = image_augmentation.augment(image, AUGMENT_N, AUGMENT_M)
Would you please refer to the code in List 5 on page 49 and try again?
After removing sharpness from augument_funcs in Listing 5, I was able to run it. Is there anything wrong with the sharpness method?
import random
#augument_funcs = [identity, crop_and_resize, shrink_and_pad, rotate, shear_x, shear_y, translate_xy, change_aspect, auto_contrast, contrast,
# brightness, posterize, mean_blur, median_blur, cutout, sharpness]
augument_funcs = [identity, crop_and_resize, shrink_and_pad, rotate, shear_x, shear_y, translate_xy, change_aspect, auto_contrast, contrast,
brightness, posterize, mean_blur, median_blur, cutout]
@tf.function(experimental_relax_shapes=True)
def augument(image, N, M):
# argumentをシャッフルしてN個選ぶ
_, ixs = tf.math.top_k(tf.random.uniform([len(augument_funcs)]), k=N)
for i in range(N):
for j in range(len(augument_funcs)):
if ixs[i] == j:
image = augument_funcs[j](image, M)
image = tf.clip_by_value(image, 0., 255.)
return image
@tosiyuki The sharpness code posted on github is the same as the one that worked in my environment. I think the cause is probably different, so could you create another thread with the error message?
@tosiyuki Thanks a lot for your comment. I also could complete it after removing sharpness.
I added list5 which is written in page.49 to image_augmentation.py. And I updated train_ds in list1 in page.45 accoridng to page.50. However, the following error is dumped when I run the updated list1.
When I use image_preprocess() instead of image_preprocess_with_augment(), the error was not dumped. I'm sorry that I don't know why image_preprocess_with_augment() dumps the error. Could you please tell me the reason and how to fix the issue if possible?