how implement cross validation with flower dataset - scikit-learn

the dataset contains 3670 images in 5 folders ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips']
i want to use vgg16 or any model and Cross-Validation to improve my accuracy, right now it's between 84-86%.

Related

Pytorch: Segmentation model's dice score is not improving if i use augmentation

I am doing a brain MRI segmentation task using Unet model. My problem is it does no matter what transformation i use during training my val dice score after few epochs stucks around 77% score.
I already have a successfuly trained model with 93% dice score on my test set, but i wanted to improve it by adding some augmentation to my training. I used transformations from the albumentation library. I only experimented with transformations that are reveleant to my train case. (Horizontal, VerticalFlip, etc ..)
Things that i already tried:
waiting for more epochs
using different transformations, using only one
using different encoders to make the model more deep, (resnet34, resnet152 etc)

Multi input & output CNN

I have the following problem:
Input: a set of 6 images
Output: a probability for each image determining whether the image is the correct one out of the 6 images
I know how to create a CNN with keras, but not how to have multiple images as an input.
How would one solve this problem?
One way I can think of is to use a pre-trained model (VGG16 etc.) and extract out the vectors from some intermediate layer, then concat 6 vectors together then feed it into a neural network (or some other classification model) and train it as a multiclass classification task.
You can also use an Autoencoder and take the anomaly detection approach.

Average weights from two .h5 folders in keras

I have trained two models on different datasets and saved weights of each model as ModelA.h5 and ModelB.h5
I want to average these weights and create a new folder called ModelC.h5 and load it on the same model architechture.
How do I do it?
Model trained on different datasets can't just be added like this. It looks something like this. Let's say like this, train one person to classify 1000 images into 5 classes, then, train another person to classify another 1000 images into same 5 classes. Now, you want to combine them into one.
Rather, what you can do is take ensemble of both the networks. There are multiple ways to ensemble the predictions of both models using Max Voting, Averaging or Weighted Average, Bagging and Boosting, etc. Ensemble helps to boost the weak classifiers into one strong classifier.
You can refer to this link to read more about different types of ensemble: Link

Is there a way to create and train a model without transfer learning using tensorflow object-detection api?

I'm using faster_rcnn_resnet50 to train a model which will detect corrosions in images and I want to train a model from scratch instead of using transfer learning.
I don't know if this right but the reason I want to do this is that the already existing weights (which are trained on COCO) will affect my model trained on corrosion images.
One way I would like to do this is randomize or unfreeze the weights of the feature extractor on the resnet50 and then train the model on my images.
but there's no function or an option in the resnet50 config file to randomize or unfreeze weights.
I've made a new labelmap with a single label and tried it with transfer learning. It's working but I would like to have a model is trained just on my images and the previous weights shouldn't affect my predictions.
This is the first time I'm working with object detection and transfer learning. Will the weights of the pre-trained model on COCO affect my model which is trained on custom images of corrosion? How do you use tensorflow object-detection API without transfer learning?

ImageNet test dataset for keras applications models

I have a model pretrained on ImageNet like this:
from keras.applications import resnet50
model = resnet50.ResNet50(weights='imagenet')
Is there any way to get test ImageNet dataset and their labels (which means data not used for training the above model)?
Original
Sadly ImageNet (from ILSVRC2012) never released the labels for the 100k images in the test dataset. You can use instead the 50k images from the Validation dataset, whose labels can be found in the Develpoment Kit (tasks 1 and 2).
You can download both the Validation images and the validation labels from http://www.image-net.org/challenges/LSVRC/2012/downloads
Updated!
There is an ImageNet Test set with 100k images available here, and although you cannot access the labels, you can instead predict the labels for all the images and submit your predictions for evaluation (top1, top5) here.
You can load a model with weights=None and download imagenet dataset.You can then split the dataset into train-test, train your model with train set and use test set for your purpose

Resources