# How could I go about implementing k-fold cross validation giving my circumstance?

The way I understand k-fold cross validation is that a given dataset or a training subset of the dataset is divided into k equal sets called folds. Then the training should be performed iteratively through each fold, where the remainder of the folds are combined forming a union on which training is performed. Lastly, the performance metric is then averaged across by k.

In my case however, I have static folder structure setup as such:

positive-negative
|
+--test:
|   +--negative:77
|   +--positive:77
+--train:
|   +--negative:154
|   +--positive:154
+--valid:
|   +--negative:26
|   +--positive:26


And I simply use batches for test, train and valid directories to retrieve the samples using ImageDataGenerator when fitting the model. Since my GPU is fairly old with only 3GB VRAM, I only load in batch sizes of 2 for each of the directories.

Given this scenario, how viable is K-fold cross validation in my scenario, and what are the approaches?

Additionally, across all my images I have a high imbalance of labelling where there is clearly a lot more labels of one class over the other:

immunonegative: 4,659
immunopositive: 1,117


To offset this, I essentially only selected as many negative samples as there is positive samples, but I can't help but feel that a lot of my data is going to waste, and I'm wonderin if there could be strategies I could employ to prevent data wastage?

"how viable is K-fold cross validation in my scenario, and what are the approaches?"

I'm not sure I understand your question. Batch size only affects how many images are passed through a network prior to backpropagation. The main limit with K-fold cross validation is the number of samples you have. In general, if you are limited in the number of samples you have and don't want to exclude too much of your data during training of each fold, you can increase K. If you are very limited in your number of samples the best option might be leave one out cross validation.

"I'm wonderin if there could be strategies I could employ to prevent data wastage"

You are probably right in thinking that a lot of your data is being wasted. One alternative to down-sampling (what you've done) is up-sampling. Up-sampling duplicates images in the smaller of your two classes until they are equally represented. There are also some more complex methods such as SMOTE that you may want to read in to.