Comments (4)
Hi there,
You should be using categorical_crossentropy
instead of sparse if your labels are one-hot encoded, this should be throwing an error. The kernel might be dying because you're running out of memory trying to process a massive batch resulting from the steps_per_epoch
parameter in your fit
function set to 1 -- this results in your batch size being equal to your entire training set. I'd change it to 60000//batch_size, where batch_size=32 or some other smaller value.
Thanks
Shawn
from dpu-pynq.
hello Shawn,
Thank you for the prompt reply.
Actually the problem persists even with small amount of dataset
xtrain=x_train[0:5000] ytrain=y_train[0:5000] batch_size = 32 func_model.fit(xtrain, ytrain, batch_size= batch_size, epochs=5, steps_per_epoch = 5000//batch_size,verbose = 2)
And for the use of steps_per_epoch I used because when fitting the model I got the following message error
ValueError: When using data tensors as input to a model, you should specify the steps_per_epoch
argument.
Thanks
from dpu-pynq.
So the kernel keeps dying? Is there any output on your terminal where you launched the jupyter notebook? The code snippet you provided works for me on a fresh docker image (vitis-ai-cpu:1.4.916) with the vitis-ai-tensorflow2 conda environment sourced. I just changed the loss function and the steps_per_epoch parameter as mentioned earlier. You also don't need to install or import keras as that is built into tensorflow2 now.
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = np.expand_dims(x_train, axis=-1)
x_test = np.expand_dims(x_test, axis=-1)
x_train = np.repeat(x_train, 3, axis=-1)
x_test = np.repeat(x_test, 3, axis=-1)
x_train = x_train.astype('float32') / 255
x_test = x_test.astype('float32') / 255
x_train = tf.image.resize(x_train, [32,32])
x_test = tf.image.resize(x_test, [32,32])
y_train = tf.keras.utils.to_categorical(y_train , num_classes=10)
y_test = tf.keras.utils.to_categorical(y_test , num_classes=10)
print(x_train.shape, y_train.shape)
print(x_test.shape, y_test.shape)
input = tf.keras.Input(shape=(32,32,3))
efnet = tf.keras.applications.ResNet50(weights='imagenet',
include_top = False,
input_tensor = input)
gap = tf.keras.layers.GlobalMaxPooling2D()(efnet.output)
output = tf.keras.layers.Dense(10, activation='softmax', use_bias=True)(gap)
func_model = tf.keras.Model(efnet.input, output)
func_model.compile(optimizer='adam',
loss="categorical_crossentropy",
metrics=['accuracy'])
func_model.fit(x_train, y_train, epochs=5, validation_data=(x_test,y_test),
steps_per_epoch = 60000//32)
If you're still having issues with training on the docker I'd recommend going to the Vitis AI issue tracker.
Thanks
Shawn
from dpu-pynq.
Hello Shawn,
Thank you for your help, it works !
Best regards
Afef00
from dpu-pynq.
Related Issues (20)
- environement mismatch problem HOT 2
- The kernel stops working when executing dpu.execute_async() in PYNQ 3.0 HOT 4
- Multiple subgraph support HOT 4
- Can't get pynq notebooks HOT 4
- One DPU on ZCU104 not working HOT 6
- Vaitrace w/ DPU-PYNQ HOT 7
- pynq-dpu examples do not work on kria-pynq
- RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'. HOT 1
- When will you support Vitis-AI-3.0? HOT 1
- Kernel Died when loading Custom model using pynq-dpu HOT 3
- I logged in as root in my ZCU111 board, but I cannot get the pip3 installed
- Is there a way to install DPU-PYNQ without the internet?
- syn failed make board=zcu104
- Hardware utilization of zcu104 HOT 2
- failing retreiving pynq-dpu abd pynq-dpu notebooks on PYNQ 2.7 on Ultra96 and ZCU104 HOT 1
- Will the latest DPU-PYNQ support Vitis-AI 2.5 and DPU v4.0? HOT 2
- Whether zynq7000 is supported HOT 1
- The next update HOT 2
- ultra96 board resetting in different dpu_conf.vh and prj_config configurations? HOT 6
- Error to compile a model _ VITIS_AI Compilation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dpu-pynq.