Closed luopinluobo closed 3 years ago
@luopinluobo you have to train a new model if you need only 1 class, you may change Dimensions, Labels but it won't work, beacuse output tensor will have size of 85 anyway and will contain predictions for all trained classes.
@kkarahainko Thank you very much for your reply. It seems that we can't directly use some trained models and use their subclasses. If the new model has only one class, will the prediction speed be significantly improved?
@luopinluobo it depends on what you're going to achieve, number of classes will not significantly improve the detection speed, pay attention to GPU acceleration, Im getting 30+ fps on laptop with rtx 3060, it's enough for tasks like video, stream processing etc.
@luopinluobo im not sure why can't you use pre-trained models )
var persons = predictions.Where(x => x.Label.Name == "person");
persons will containt only "person" predictions
@kkarahainko I just want to test whether there is a big improvement. Now I have also obtained 30 + FPs in gtx1080ti, but the target machine is gtx1050. I haven't tested whether it can be met, so I want to find out whether there is any way to improve the speed. If the speed meets my requirements. I will use your recommendation and filter the results
@kkarahainko It seems that [Python] can be used, but I don't know how to use .Net to implement it
@luopinluobo technically it's possible, copy whole tensor to smaller one, like this
var output = new DenseTensor<float>(new[] { 1, 25200, 6 });
Parallel.For(0, 1, (a) =>
{
Parallel.For(0, 25200, (b) =>
{
Parallel.For(0, 6, (c) =>
{
output[a, b, c] = original[a, b, c];
});
});
});
but I didn't see any difference + C# has no Tensor range and GPU acceleration operations, so I've decided not to implement this type of filtering for now, see no sense and didn't find elegant way.
I have a few questions:
I am a beginner of yolov5. This code example is very helpful to me. Thank you