Thanks for your reply! I have tried a smaller batch size and removed the copy() from the code but the i keep getting the same error message. Is there anything else you might suggest. I am running this code using a different CNN model it works okay but when i use the VGG model i get this error message.