Yolov4 error when trying to display image on custom model - cmd

I have trained my own model, using my own custom dataset, using Yolov4, and I have downloaded the .cfg, .weights and .data files.
When I try to run my model using:
darknet.exe detector test cfg/obj.data cfg/yolov4-og.cfg custom-yolov4-detector_best.weights
I get the error:
Error: l.outputs == params.inputs filters= in the [convolutional]-layer doesn't correspond to classes= or mask= in [yolo]-layer
I don't know if this is an error on my part, with the command I am running, or an error from the model I trained.
Any help would be appreciated.

I am assuming you are using the main darknet repo AlexeyAB. Please make sure you follow the following instructions:
Make sure you assign the correct classes number in the config file.
Change filters=255 to filters=(classes + 5)x3 in the 3
[convolutional] before each [yolo] layer, keep in mind that it only
has to be the last [convolutional] before each of the [yolo] layers
https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L603
https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L689
https://github.com/AlexeyAB/darknet/blob/0039fd26786ab5f71d5af725fc18b3f521e7acfd/cfg/yolov3.cfg#L776
So if classes=1 then should be filters=18. If classes=2 then write filters=21
(Generally filters depends on the classes, coords and number of masks, i.e. filters=(classes + coords + 1)*, where mask is indices of anchors. If mask is absent, then filters=(classes + coords + 1)*num)
Reference: https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects

Related

Yocto PREMIRROR/SOURCE_MIRROR_URL with url arguments (SAS_TOKEN) possible?

I sucessfully created a premirror for our yocto builds on an Azure Storage Blob,
that works if I set the access level to "Blob (Anonymous read).."
Now I wanted to keep the blob completely private, and access only via SAS Tokens.
SAS_TOKEN = "?sv=2019-12-12&ss=bf&srt=co&sp=rdl&se=2020-08-19T17:38:27Z&st=2020-08-19T09:38:27Z&spr=https&sig=abcdef_TEST"
INHERIT += "own-mirrors"
SOURCE_MIRROR_URL = "https://somewhere.blob.core.windows.net/our-mirror/downloads/BASENAME${SAS_TOKEN}"
BB_FETCH_PREMIRRORONLY = "1"
In general this works, but yocto (or to be exact the bitbake fetch module) will try then try to fetch from https://somewhere.blob.core.windows.net/our-mirror/downloads/bash-5.0.tar.gz%3Fsv%3D2019-12-12%26ss%3Dbf%26srt%3Dco%26sp%3Drdl%26se%3D2020-08-19T17%3A38%3A27Z%26st%3D2020-08-19T09%3A38%3A27Z%26spr%3Dhttps%26sig%3Dabcdef_TEST/bash-5.0.tar.gz
Which also encodes the special characters for the parameters and of course the fetch fill fail.
Did anybody has solved this or similar issues already?
Or is it possible to patch files inside the poky layer (namely in ./layers/poky/bitbake/lib/bb/fetch2) without changing them, so I can roll my on encodeurl function there?

How to save fasttext model in binary and text formats?

The documentation is a bit unclear how to save the fasttext model to disk - how do you specify a path in the argument, I tried doing so and it failed with an error
Example in documentation
>>> from gensim.test.utils import get_tmpfile
>>>
>>> fname = get_tmpfile("fasttext.model")
>>>
>>> model.save(fname)
>>> model = FastText.load(fname)
Furthermore, how can I save the model in text format like can be done with word2vec models?
'word2vecmodel.wv.save_word2vec_format("D:\w2vmodel.txt")'
EDIT
After trying the suggestion to make a file first I keep kgetting the same error as before when I run this code
savepath = os.path.abspath('D:\fasttextmodel.v3.bin');
from gensim.test.utils import get_tmpfile
fname = get_tmpfile(savepath)
fasttext_model.save(fname)
TypeError: file must have a 'write' attribute
Documentation in FastText save()/load() example is misleading, they suggest you use get_tmpfile. I am able to save the model if I pass the data file name as a string and do not wrap it in get_tmpfile:
model.save("fasttext.model")
Then you can load the same way, passing the string directly:
model = FastText.load("fasttext.model")
Note that this will save multiple files for models that are large. However, when you load the model, you only need to specify the main fasttext.model file, and the function will automatically load additional files, if there are any.
Did you try creating a file in your local directory called "fasttext.model" before trying to save it?
Also, I'm assuming you trained the model before this correct?

Why is RStudio giving an error when using plotFun from the Mosaic package?

My students are using the Mosaic package for RStudio, and one of them is not able to use the function plotFun. Every time she tries to use it, she gets the same error. For example,
> plotFun(x+2~x)
Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class ‘"formula"’ to a data.frame
Are there any thoughts as to what is going wrong? She will need to use this function often for this class; is she missing a package or update of R or RStudio?

Adding Edge Label Titan-Rexster

I am imlpementing the Titan graph database with Rexster and Cassandra.
I try to add an edge like this in Ruby with Gremlin:
query = 'a = g.addVertex(null,[name:\'' +
someName +
'\']); g.addEdge(null, g.getVertex(' +
someVertexId + '), a, \'labelname\', [weight:' +
someFloatValue.round(5) + 'd]); g.commit();'
#This formats to the following:
#"a = g.addVertex(null,[name:'myawesomename']); g.addEdge(null, g.getVertex(1337), a, 'labelname', [weight:0.30685d]); g.commit();"
After running this I get the following error:
#<Rexster::Rest::RexsterError: Graph server returned error: javax.script.ScriptException: java.lang.IllegalArgumentException: The type of given name is not a label: labelname>
It seems like I have not defined the label with the name labelname, I got that. However, I can not for the life of me figure out how to add this label so I am able to add this edge to the graph.
Adding vertices works fine by the way.
I am using the rexster_ruby gem which connects to a ubuntu 12.04 machine with titan-server 0.4.0 running the titan.sh script.
The Titan TypeMaker has seen some serious API changes going from 0.3.x to 0.4.x. You can read about how to define an edge label here:
https://github.com/thinkaurelius/titan/wiki/Type-Definition-Overview#creating-edge-labels
It is is recommended that you use the TypeMaker at initialization of your graph, preferably outside of libraries like rexster_ruby, REST, etc. Simply initialize your graph from the Gremlin REPL. Even better, encapsulate those type definitions in a groovy class to maintain your schema.

phmagick class not found on laravel 4

After installing phmagick using composer I'm getting a class not found error. I think it's because of how the Action classes are being loaded, but is there a fix for it?
Have a look in vendor/francodacosta/phmagick/docs/index.html for actual documentation about phMagick. Here's one of the examples which works for me...
$phMagick = new \phMagick\Core\Runner();
$action = new \phMagick\Action\Convert($this->originalFile, $this->newFile);
// optimize the image
$action->optimize();
// sets image quality
$action->quality(70);
// execute the convert action
$phMagick->run($action);

Resources