-
Notifications
You must be signed in to change notification settings - Fork 277
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
Prolem in training phase #66
Comments
Are you using the tensorflow 1.x scripts or tensorflow 2.x? |
I'm using tensorflow 2.x |
Are you manually creating train and validation directories? Cause you shouldn't be. You just do: Images/class_a/*.jpg The script automatically discovers all images in the class dies and splits them into train/value sets. |
Hmm. Can you provide some error message/the training script output? |
You're running the tensorflow 1.x scripts, which I dont believe support what you're doing. I didn't write them. I wrote the v2 scripts (well, imported from tfhub and heavily modified). |
So if I run v2 scripts everything will be fine ? |
It should be. You have to use tensorflow hub modules and supply one. Example usage is shown in the training scripts |
@GantMan Can you help me with this issue from v1 scripts, please ? |
Can you send me v2 scripts please, 'cause I can't find it in repo, the lastest version is 1.2.0 |
Hi @TechnikEmpire , During training I got this error. What is happening here, can you help me D:\WORKING\Human_detection\Deep_learning-ver\nsfw_porn_detection\nsfw_model-1.1.0\nsfw_model-1.1.0>python ./training/make_nsfw_model.py --image_dir ./images --image_size 224 --saved_model_dir ./trained_models\inception_v3_224 --labels_output_file ./trained_models\inception_v3_224\class_labels.txt --tfhub_module https://tfhub.dev/google/imagenet/inception_v3/classification/4 --tflite_output_file ./trained_models\inception_v3_224\saved_model.tflite --train_epochs 5 --batch_size 16 --do_fine_tuning --learning_rate 0.001 --dropout_rate 0.0 --momentum 0.9 Layer (type) Output Shape Param #keras_layer (KerasLayer) (None, 1001) 23853833 dropout (Dropout) (None, 1001) 0 dense (Dense) (None, 2) 2004 prediction (Activation) (None, 2) 0Total params: 23,855,837 None File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\ops\script_ops.py", line 243, in call File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 309, in wrapper File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 785, in generator_py_func File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 801, in wrapped_generator File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 932, in generator_fn File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\iterator.py", line 65, in getitem File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\iterator.py", line 230, in _get_batches_of_transformed_samples File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\utils.py", line 114, in load_img File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\PIL\Image.py", line 2931, in open PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001DD0B030048> 1926/6273 [========>.....................] - ETA: 1:18:19 - loss: 0.6066 - accuracy: 0.9288Traceback (most recent call last): File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\ops\script_ops.py", line 243, in call File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 309, in wrapper File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 785, in generator_py_func File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 801, in wrapped_generator File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 932, in generator_fn File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\iterator.py", line 65, in getitem File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\iterator.py", line 230, in _get_batches_of_transformed_samples File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\utils.py", line 114, in load_img File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\PIL\Image.py", line 2931, in open PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001DD0B030048>
(1) Unknown: UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001DD0B030048> File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\ops\script_ops.py", line 243, in call File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 309, in wrapper File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 785, in generator_py_func File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 801, in wrapped_generator File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 932, in generator_fn File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\iterator.py", line 65, in getitem File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\iterator.py", line 230, in _get_batches_of_transformed_samples File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\keras_preprocessing\image\utils.py", line 114, in load_img File "C:\Users\AI2\AppData\Local\Programs\Python\Python37\lib\site-packages\PIL\Image.py", line 2931, in open PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001DD0B030048>
0 successful operations. Function call stack: |
Read through the stack trace and Google it. For example: So we can very quickly surmise that you have a image where the file type is unsupported or its corrupt, or possibly even an empty file. It could also be that you need to update pillow. Check your data. |
Please close this issue and open separate tickets for separate problems. Itll help others in the future when they're trying to solve similar issues or get more information about a specific issue they encounter. |
|
Hi, @GantMan @jessetrana @txyugood @TechnikEmpire @sickerin
I'm a college student and I'm studying your project. I want to train my own model with only 2 classes, I placed 2 folders of images (which represent for 2 classes images) in project's image directory but training scripts fail to separate train/test/validation folder from my 2 images folders. How can I fix this??
Thank you.
The text was updated successfully, but these errors were encountered: