I´ve trained a model on YOLOv5 for detecting custom objects. Is there a tool to use those weights to label new images showing the same classes?
Thanks!
Try this:
python detect.py img.jpg --save_txt
If you want to filter detections by class, try this
python detect.py img.jpg --save_txt --class 0 2 3
The example will keep those objects belonging to classes 0, 2, and 3.
Related
I am applying SHAP on XGBoost regressor. I am trying to plot the interaction effects. But the summary plot is displaying only few variables. What to do in case of more than 10 variables?
I tried using "shap.summary_plot(shap_interaction_values, X)" but this is showing only 6 variables whereas I want it to show all the variables in the model which is 16.
Have you tried using the max_display parameter yet?
Documentation: https://shap-lrjball.readthedocs.io/en/latest/generated/shap.summary_plot.html
For example:
shap.summary_plot(shap_interaction_values, X, max_display=20)
I created a NaiveBayes model in Weka. I exported the model to disk. I now want to inject this model into MATLAB 2018, so that I can check how it performs via some data that I am receiving.
I load my model in MATLAB, by stating something like this:
loadedModel = weka.core.SerializationHelper.read('myweka.model');
I then create a Weka Instance object, and let it contain this data:
instance = infrequent,low,high,medium-high,high,medium,medium,low,low
If I run these two commands:
loadedModel.distributionForInstance(instance)
loadedModel.classifyInstance(instance)
I see the following output:
0.0001
0.9999
1
This is odd to me because if I observe the same record in WEKA ui, I see the same instance with probabilities 0.993 and 0.007, classified as '2'. (I can load the same model multiple times from disk in WEKA, and reproduce this behavior, which is correct) After further investigation, I noticed that regardless of the sequence of attributes my Instance object has, I always get the same probability output and the same classification by invoking the model via MATLAB.
There are some posts on the net that share the same problem, like these:
Always getting the same output
Weka - Classifier returns the same distribution for any input
However, the recommended solution to call 'instance.setClassMissing()' did not solve my issue. Is there anything I am missing, or can try to do in order to further troubleshoot the issue?
Does your test instance has same structure as your train set? If not, you need yo provide the same structure.
Weka indexes nominal attributes and stores the indices internally. So the nominal attributes order in train file is important. For example if your attribute is mapped as low=>0, high=>1 in training, you need to map them like this in your test set. Usually this is achieved by serializing the train header with the model.
Sample code for creating train header:
Instances trainHeader = new Instances(instances, 0);
trainHeader.setClassIndex(instances.classIndex());
When creating a new instance set its dataset:
Instance instance = ...
instance.setDataset(trainHeader);
I want to know that I am using GRASS GIS correctly. I'm having trouble merging these two shapefiles
http://www.gisdeveloper.co.kr/download/admin_shp/EMD_201902.zip
http://www.gisdeveloper.co.kr/download/admin_shp/LI_201902.zip
How would you go about the process of dealing with shapefiles which have errors like this?
I've tried importing and cleaning using both QGIS and GRASS but I always end up with warnings like this:
WARNING: Number of centroids exceeds number of areas: 32665 > 20038
WARNING: Number of incorrect boundaries: 62688
WARNING: Number of centroids outside area: 12461
WARNING: Number of duplicate centroids: 3210
I've tried changing the snapping threshold for v.in.ogr but it doesn't seem to make a difference
when I try doing v.patch it looks like this: https://i.imgur.com/u6Sqom5.png
I'd like to end up with something that looks like this but on one layer with no overlap so that there is a 1 to 1 relationship with every space on the map: https://i.imgur.com/5VtWSsR.png
You can use QGIS (SAGA tool) to merge the layers and then import the new layer to GRASS environment:
Vector ‣ Data Management Tools ‣ Merge vect Layers
Or you can also create a pipeline using bash in which you automate this function by importing the layer in grass.
I hope it helps you :)
I'm completely new to Matlab and I need some help.
I'm running a self-organising map with the Neural Networks toolbox.
It all works fine, I use
net = selforgmap([x y]);
net = train(net,mydata);
and then I get access to the nice plots.
However I'm interested in the actual numbers generated by the som.
1)How do I access all the data underneath (is there a way to show all the vectors generated by the som package?
For example:
2)how do I access the nodes weights?
3)How do I access the list of cases and their allocated Best Matching Units?
Many thanks
Unfortunately, I don't have R2012, (and thus, I don't have 'selforgmap'), so this answer is potentially too general.
That said, I suspect that the variable 'net' is a a Neural Network object and if you type into the Command Window
net
Then you'll get a display of properties in that object (here's a shortened version of what I get)
net =
Neural Network object:
architecture:
numInputs: 1
numLayers: 2
biasConnect: [1; 1]
inputConnect: [1; 0]
layerConnect: [0 0; 1 0]
outputConnect: [0 1]
numOutputs: 1 (read-only)
numInputDelays: 0 (read-only)
numLayerDelays: 0 (read-only)
And then you can access these properties like this:
net.numInputs
And if you want to see the methods available for that variable, you can do
methods(net)
I have an unlabeled dataset that I want to classify with my newly trained classifier using NaiveBayes classification in Weka. So actually when in the Classify mode in weka if i give the option Supplied Test set, then it accepts the test set only if it is labelled and evaluates and gives the accuracy.
But what I want is to train it using a train.csv or train.arff file and then give it a new unseen and unlabelled test.csv or test.arff file and classify it and give it labels depending on classes in the training file. But if I provide an unlabelled file as test file to wweka it gives:
ERROR: Train and Test set not compatible
Sample format of my Train and test files are as below:
Train.csv file:
article story .......hockey class
1 0 ...... 0 politics
0 0 .......1 sports
.
.
.
.
. sports
and Test.csv file:
article story .......hockey class
0 1 ...... 0
1 0 .......1
.
.
.
.
.
So how do I classify an unlabelled dataset in Weka using NaiveBayes classifier??
It seems you are missing the class label. Weka requires training and test set to have the exact same attributes in the same order. Now there are two cases:
You know the classes of your test set
The performance is calculated by comparing the actual class labels with the predicted ones. You need to supply the class labels in your test set like you did in your training set.
You DON'T know the classes of your test set
To calculate a performance, Weka needs to compare the predicted classes with the actual classes. If you don't have the actual classes, you cannot calculate the performance. You can only predict classes.
You have to add a class label with missing values for your test instances if you just want prediction.
Even if your test set is labelled, Weka will not see it at first stage. It will use the classifier you developed with training data and then will apply the classifier on the test set you supply. The classifier then predicts each instance class and Weka then keeps track of a correct or incorrect classification. So, what you are doing here is exactly what you are trying to achieve. The error is telling that the training and test sets are not compatible because I believe you have removed the "class" label from the test set. Don't worry. Keep it as it is and the accuracy you are getting from Weka is the actual performance of the classifier. Hope that helps.
you cant leave it all empty, you need to set at least one each class label on the class field (as some kind of "clue" for the weka)
article story .......hockey class
0 1 ...... 0 politics
1 0 .......1 sport
1 1 .......1 ?
1 1 .......1 ?
the two first row will provide weka an example of the prediction class. Then you can predict as much as instance with no class (?) using your trained model