Skip to content
Advertisement

How to append 0 and 1 to different classes of images / deep learning

I am a beginner in python and deep learning language, I am creating my list of X_train composed of two different classes of images and I would like to assign 0s and 1s to each class.

So let’s say

JavaScript

So I would like to assign 0s and 1s to the image classes in my Y_train list I share with you these two lines of code which summarize my reasoning and which are obviously false since I am here looking for solutions

JavaScript

What is the correct way to do this? Thank you in advance for your answers.

Advertisement

Answer

This way at the end of the code Y_train will include two lists, the first one is of all the images of type imageB and the second one of all the images of the type imageA

I wasn’t sure how you meant to identify which image is witch so I used is but feel free to replace it with any way you want

JavaScript

If my comment helped you please consider marking it as the answer :)

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement