PC Reboot when run tensorflow image clasification

I run successfull on notebook in Google but on my PC with 16GB RAM & Core I7 G10 computer is reboot, the same occurs with opencv

Thanks for your comments, i am beginner on Tensorflow an AI

is it necesary to do? Installation — TensorFlow 2 Object Detection API tutorial documentation

from tensorflow.python import training

import tensorflow as tf

from tensorflow import keras

import numpy as np

import os

import zipfile

from keras.preprocessing.image import ImageDataGenerator

import matplotlib.pyplot as plt

local_zip = ‘rps.zip’

zip_ref = zipfile.ZipFile(local_zip,‘r’)

zip_ref.extractall(‘tmp/’)

zip_ref.close();

local_zip = ‘rps_validation.zip’

zip_ref = zipfile.ZipFile(local_zip,‘r’)

zip_ref.extractall(‘tmp/rps_validation/’)

zip_ref.close();

local_zip = ‘rps_test_set.zip’

zip_ref = zipfile.ZipFile(local_zip,‘r’)

zip_ref.extractall(‘tmp/’)

zip_ref.close();

TRAINING_DIR = “tmp/rps/”

TEST_DIR = “tmp/rps-test-set/”

VALIDATION_DIR = “tmp/rps_validation/”

training_datagen = ImageDataGenerator(rescale = 1./255)

test_datagen = ImageDataGenerator(rescale = 1./255)

validation_datagen = ImageDataGenerator(rescale = 1./255)

train_generator =training_datagen.flow_from_directory(

TRAINING_DIR,

target_size=(150,150),

class_mode='categorical'

)

test_generator =test_datagen.flow_from_directory(

TEST_DIR,

target_size=(150,150),

class_mode='categorical'

)

validation_generator =validation_datagen.flow_from_directory(

VALIDATION_DIR,

target_size=(150,150),

class_mode='categorical'

)

#Imprimimos la segunda imagen del test

batch = next(test_generator)

img = batch[0][1]

plt.imshow(img)

model = tf.keras.models.Sequential ([

tf.keras.layers.Conv2D(64, (3,3), activation='relu', input_shape=(150,150,3)),

tf.keras.layers.MaxPooling2D(2,2),

tf.keras.layers.Conv2D(64,(3,3), activation='relu'),

tf.keras.layers.MaxPooling2D(2,2),

tf.keras.layers.Conv2D(64,(3,3), activation='relu'),

tf.keras.layers.MaxPooling2D(2,2),

tf.keras.layers.Conv2D(64,(3,3), activation='relu'),

tf.keras.layers.MaxPooling2D(2,2),

tf.keras.layers.Flatten(),

tf.keras.layers.Dropout(0.5),

tf.keras.layers.Dense(512, activation='relu'),

tf.keras.layers.Dense(3, activation='softmax')

])

model.compile(optimizer=‘rmsprop’, loss=‘categorical_crossentropy’, metrics=[‘accuracy’])

history = model.fit_generator(train_generator, epochs=25, validation_data = validation_generator, verbose=1)

model.save(‘store/priedra_papel_tijera’)

@Jose_Alberto_San_Jua,

Welcome to the Tensorflow Forum!

is it necesary to do? Installation — TensorFlow 2 Object Detection API tutorial documentation

There is no requirement for object detection here, as your usage case is image classification.

Can you tell us about the steps you have taken to install Tensorflow and what is the TensorFlow version?

Thank you!

Thanks, for your help

tensorflow version 2.10
python version 3.10

To install

pip install -U "tensorflow>=2.5"

When check tensorflow version i get this warning

2022-12-29 09:06:35.488584: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found

2022-12-29 09:06:35.488731: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

In this case I dont know, What I need to do?

I debug line by line, reboot occur at line

model.fit_generator(train_generator, epochs=5, validation_data = validation_generator, verbose = 1)

@Jose_Alberto_San_Jua,

2022-12-29 09:06:35.488584: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found

Ignore above cudart dlerror if you do not have a GPU set up on your machine.

These are just the Information and Warning messages as these are prefixed with I for Information and W for warnings, else if this was the error message, these would be prefixed with E .

Can you please share the rps.zip dataset to debug the above issue?

Thank you

for trains

https://storage.googleapis.com/laurencemoroney-blog.appspot.com/rps.zip

for test

https://storage.googleapis.com/laurencemoroney-blog.appspot.com/rps-test-set.zip

Excuse me,

How can i do it?, I did not found the option to attach zip file

thanks

thanks,

I found solution installing Anaconda to optimaze my cpu & CPU

Glad the issue is resolved for you!

1 Like

For other people that end up here: Sometimes a GPU will briefly draw more power than is available from the power supply which causes the computer to reboot. I think the Windows + video games have protections against that sort of stuff but ML frameworks do not. And this is model architecture dependent meaning that you can train some models without issues but then others draw more power at peak and reboot your computer.

1 Like

Thank you very much for your opinion, my equipment does not have the characteristics to support heavy training

1 Like

Hehe, I’ve only experienced on a standard machine with a 800 W power supply and 2 RTX 2080Ti both training language models.