I have a group of images with ground truth detection boxes and I want to simply run them through a pre-trained model from the Model Zoo and get the, say, precision/recall/mAP between the ground truth boxes and predicted detections. But all the evaluation methods I've seen use training/validation data that I never specified in the first place because I'm using a pre-trained model.
It seems like a simple question, but I can't seem to find an answer. How can I go about doing this?
If your images happen to be of something that one of the models in the model zoo is already trained on, then you could run inference on them and get predictions.
However, to get meaningful metrics on a custom dataset, you will have to do some training; starting with one of the models in the model zoo is a great idea. Here are a couple tutorials that might help:
https://pythonprogramming.net/custom-objects-tracking-tensorflow-object-detection-api-tutorial/
https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/
Related
i'm currently using u-net model with different backbone (resnet,mobilenet ... vs) to segment Ct-Scan image
and after i train the models and get the prediction masks i need to use another model that going to take test set model output and divide them into two group either good prediction or bad prediction the images bellow show two example where one is considered as good prediction and the other is not good predictionbad prediction
is there any pre-trained models that i can directly use if not what kind of model i should use ?
i just want to mention that i'm new to this staff
I am currently working on a system that extracts certain features out of 3D-objects (Voxelgrids to be precise), and i would like to compare those features to automatically made features when it comes to performance (classification) in a tensorflow cNN with some other data, but that is not the point here, just for background.
My idea now was, to take a dataset (modelnet10), train a tensorflow cNN to classify them, and then use what it learned there on my dataset - not to classify, but to extract features.
So i want to throw away everything the cnn does,except for what it takes from the objects.
Is there anyway to get these features? and how do i do that? i certainly have no idea.
Yes, it is possible to train models exclusively for feature extraction. This is called transfer learning where you can either train your own model and then extract the features or you can extract features from pre-trained models and then use it in your task if your task is similar in nature to that of what the pre-trained model was trained for. You can of course find a lot of material online for these topics. However, I am providing some links below which give details on how you can go about it:
https://keras.io/api/applications/
https://keras.io/guides/transfer_learning/
https://machinelearningmastery.com/how-to-use-transfer-learning-when-developing-convolutional-neural-network-models/
https://www.pyimagesearch.com/2019/05/27/keras-feature-extraction-on-large-datasets-with-deep-learning/
https://www.kaggle.com/angqx95/feature-extractor-fine-tuning-with-keras
I am training a model to detect buildings from satellite images in rural Africa. For labels, I use OpenStreetMap geometries. I use the Tensorflow Object Detection API and SSD Inception V2 as a model and I use the default config file. I trained separate models on two different datasets (in different geographical regions). In one area, the model behaves like I would expect:
When training the model in the other area, however, it's performance jumps up and down:
Note that I use the exact same model, configuration, batch size, the training area is of the same size, etc. In the second case, the model's prediction change extremely rapidly and I am not able to see why. For example, here is a comparison of the predictions the model makes at 107k and 108k global steps (i.e. I'd expect the predictions to be similar):
I am quite new to deep learning and cannot understand why this might happen. It might be something simple that I am overlooking. I've checked the labels and they are ok. Also, I thought that it could be a bad batch that in every epoch turns the training in the wrong direction but this is not the case - the performance drops like that for up to several epochs.
I would be very grateful for any tips where to look, etc. I am using TF 1.14.
Let me know if I should provide more information.
I am following this tutorial:
https://www.tensorflow.org/tutorials/keras/text_classification_with_hub
It only goes up to fitting the model but I couldn't find how to use the model on a new dataset to classify unlabeled data. I tried following other tutorials but I couldn't get them to work since they might not be text based.
model.add(tf.keras.layers.Dense(1))
I run into an issue where I try to set the layer to 2 for positive, negative but that doesn't work either.
I think you misunderstood the purpose of that tutorial. That tutorial is applying the use of what is known as "transfer learning". Transfer Learning is when you take an already trained model, and train it with other data. What you are doing is creating an entirely new model, which is not the purpose of that specific tutorial. Furthermore, for that model you need a labeled dataset, which is provided in the tutorial using the Tensorflow Datasets library. To accomplish what you are trying to do, you must look at a different tutorial explaining how to train an LSTM model for text classification from scratch.
I made a simple CNN that classifies dogs and cats and I want this CNN to detect images that aren't cats or dogs and this must be a third different class. How to implement this? should I use R-CNN or something else?
P.S I use Keras for CNN
What you want to do is called "transfer learning" using the learned weights of a net to solve a new problem.
Please note that this is very hard and acts under many constraints i.e. using a CNN that can detect cars to detect trucks is simpler than using a CNN trained to detect people to also detect cats.
In any case you would use your pre-trained model, load the weights and continue to train it with new data and examples.
Whether this is faster or indeed even better than simply training a new model on all desired classes depends on the actual implementation and problem.
Tl:Dr
Transfer learning is hard! Unless you know what you are doing or have a specific reason, just train a new model on all classes.
You can train that almost with the same architecture (of course it depends on this architecture, if it is already bad then it will not be useful on more classes too. I would suggest to use the state of the art model architecture for dogs and cats classification) but you will also need the dogs and cats dataset in addition to this third class dataset. Unfortunately, it is not possible to use pre-trained for making predictions between all 3 classes by only training on the third class later.
So, cut to short, you will need to have all three datasets and train the model from scratch if you want to make predictions between these three classes otherwise use the pre-trained and after training it on third class it can predict if some image belongs to this third class of not.
You should train with new_category by add one more category, it contains images that are not in 2 category before. I mean
--cat_dir
-*.jpg
--dog_dir
-*.jpg
--not_at_all_dir
-*.jpg
so.. total categories you will train are 3 categories.
(categories or classes whatever it is)
then add the output of final dense fullyconnected (3 categories)