Giter VIP home page Giter VIP logo

Comments (42)

glenn-jocher avatar glenn-jocher commented on May 13, 2024 9

@AyushExel @cip8 @luccahuguet @SkalskiP @dmddmd @1a11 @AI-P-K @Laughing-q @Fabio-Arup-Panella all YOLOv8 classification issues are now resolved. Bugs have been resolved, models retrained and ImageNet codes are automatically translated to human readable labels if present.

Usage:

yolo predict model=yolov8m-cls.pt save
WARNING ⚠️ 'source' is missing. Using default 'source=/Users/glennjocher/PycharmProjects/ultralytics/ultralytics/assets'.
Ultralytics YOLOv8.0.31 πŸš€ Python-3.10.6 torch-1.13.1 CPU
YOLOv8m-cls summary (fused): 103 layers, 17043656 parameters, 0 gradients, 42.7 GFLOPs

image 1/2 /Users/glennjocher/PycharmProjects/ultralytics/ultralytics/assets/bus.jpg: 224x224 minibus 0.60, police_van 0.19, trolleybus 0.11, amphibian 0.05, streetcar 0.02, 33.0ms
image 2/2 /Users/glennjocher/PycharmProjects/ultralytics/ultralytics/assets/zidane.jpg: 224x224 suit 0.54, bow_tie 0.32, rugby_ball 0.04, groom 0.02, Windsor_tie 0.02, 33.0ms
Speed: 0.1ms pre-process, 33.0ms inference, 0.2ms postprocess per image at shape (1, 3, 224, 224)
Results saved to /Users/glennjocher/PycharmProjects/ultralytics/runs/classify/predict2

zidane

bus

Closing as resolved. Please let us know if this resolves your issues and feel free to let us know how we can do better! Thanks!!

from ultralytics.

Fabio-Arup-Panella avatar Fabio-Arup-Panella commented on May 13, 2024 3

I have the same problem as @luccahuguet.
Installed ultralytics with pip.
I tested the detection and the segmentation. They work just fine.
When I test the clssification, the results don't make much sense: The top five classes are all equally zero.
Can you please help?

yolo classify predict model=yolov8n-cls.pt source="https://ultralytics.com/images/bus.jpg" # predict with official model
bus

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024 1

Right..so basically softmaxed logits? And we can also provide an attribute .names for models.

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024 1

@AyushExel Yeah sorry. That's what happens when you record the YT segmentation tutorial and test the classification model at the same time πŸ˜†

btw I noticed improvements ;) The images have the probabilities now ;)

download (12)

And that class name problem is there only for the pre-trained model, when I train the custom one looks good. Just a pain to use it when I won't get that in text format.

download (13)

from ultralytics.

Laughing-q avatar Laughing-q commented on May 13, 2024 1

@AI-P-K the output of predict is a python generator for now.
you can try this to get your results:

for output in results:
    pass

the output is a dict including predictions with numpy format for now, check this comment #239 (comment).

In fact, we're working on this, the dict solution could be a temporary state. We'll let you know once we give out a good solution of this. :)

from ultralytics.

luccahuguet avatar luccahuguet commented on May 13, 2024 1

Hi, I'll add that I seem to be having a different problem during the same task, and all I did was follow the notebook instructions. Also tried both pip install method and git clone

image

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024 1

@dmddmd okay now I can reproduce. The generator is returning list[list[Result]] instead of list[Result]. We'll fix that

from ultralytics.

1a11 avatar 1a11 commented on May 13, 2024 1

Been trying to figure it out for like a solid 4 hours. Have absolutely no idea how probs works. In both streaming mode and non-streaming mode, the output is None.

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024
  • Yeah, I think it's using folder ids instead of imagenette class names. We'll fix that. Same for logits. we should be plotting probabilities.
  • Yeah I get your point.. Saving labels on img doesn't make sense by default.. It should be behind a feature flag. or it should be combined in save_txt flag. But you can still get the cls logits now through python interface to make it a part of automated workflow. logits = model(img)

@glenn-jocher its probably because of the move from nn.CrossEntropy to functional as it doesn't require softmaxed values....

from ultralytics.

glenn-jocher avatar glenn-jocher commented on May 13, 2024

We need to do some cleanup here. Saving should only occur on save=True, but I see this is the default as the same arg controls checkpoint saving during training

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

@AyushExel when I do:

from ultralytics import YOLO

model = YOLO('yolov8n-cls.pt')
results = model.predict(source='https://media.roboflow.com/notebooks/examples/dog.jpeg', conf=0.25)

I get:

[tensor([-1.02325e+00,  2.79760e+01,  5.27789e+00, -7.33197e+01, -2.43017e+01,  3.53219e+01, -3.36309e+01, -7.41147e+00, -3.35038e+01, -4.11602e+01, -2.37091e+01, -5.40865e+01, -8.24823e+01, -1.06338e+02, -1.40612e+02, -2.92780e+01, -5.66041e+01, -1.07003e+02, -2.65265e+01, -6.18118e+01, -9.80241e+01, -5.57144e+01,
         -7.35527e-01, -5.29373e+01, -1.29773e+01, -5.39948e+01, -8.01088e+01, -1.71575e+01, -6.71371e+01, -1.08865e+02, -9.38421e+01, -7.16984e+01, -1.06259e+02, -1.06090e+01,  6.09537e+01, -3.23948e+01,  2.74663e+01, -2.29462e+01, -3.48702e+01, -2.12547e+01,  4.94374e+01, -3.81131e+01, -5.81450e+01,  8.46872e+00,
         -3.51847e+01, -9.21345e+01,  1.94015e+01, -2.54320e+01, -4.06225e+01, -4.72643e+01, -1.89610e+01, -4.35960e+01, -4.45816e+01, -1.93606e+01,  3.97520e+00, -6.16173e+01, -5.15834e+01, -5.25939e+01, -9.25432e+01, -5.83241e+01, -1.12510e+01, -7.64855e+01, -1.16864e+02, -2.11810e+01, -7.98756e+01, -1.09648e+01,
         -4.49235e+01, -3.73703e+01, -1.12215e+02, -8.78379e+01, -8.00065e+01, -3.49635e+01, -8.11417e+01, -5.74624e+01, -6.07559e+01,  3.53035e+01,  1.19078e+01,  3.14100e+01, -6.52969e+01,  5.19492e+01, -6.79541e+01, -1.56880e+02, -9.15941e+01, -1.41974e+01, -1.79257e+01, -6.74180e+01, -6.07486e+01,  3.68198e+01,
         -3.93616e-01, -1.23448e+02,  4.05800e+01, -4.16412e+01, -5.41952e+01, -1.04645e+02,  5.34444e+00, -2.09958e+01,  8.79452e+01,  5.73626e+00, -4.64416e+01, -4.14152e+01, -7.19045e+00, -1.20159e+02, -8.72846e+01, -9.53829e+01, -9.29843e+01, -1.41160e+02, -5.43346e+01,  3.57679e+01, -4.31158e+00,  3.86568e+00,
          1.50525e+01,  3.74256e+01,  1.00100e+02, -5.72975e+01, -5.76414e+01,  5.30612e+01, -5.53313e+01,  4.64637e+01,  1.77338e+01, -2.77146e+01, -6.41624e+01,  4.60932e+01, -2.88866e-01, -1.26166e+01,  1.41239e+01, -9.93353e-01, -7.23875e+01, -8.60334e+01, -4.70571e+01, -1.00046e+02, -2.29949e+01, -1.66646e+02,
         -9.46308e+01, -8.78054e+01, -1.05471e+02, -1.01092e+02, -1.23352e+02, -6.74758e+01, -1.25910e+02, -2.96013e+01, -1.32247e+02, -3.20342e+00, -9.93548e+01, -7.79731e+01, -1.87667e+01,  6.91437e+01, -6.48878e+01, -2.09117e+01, -4.16891e+01, -1.39610e+01,  1.08903e+01,  1.02864e+01, -2.23984e+01, -1.19952e+01,
         -3.40192e+01,  1.68546e+01,  3.49642e+01,  4.80147e+01, -1.32178e+01, -6.61634e+01, -2.34595e+01, -8.74431e+01,  9.34860e+00, -9.59003e+00, -1.95232e+01,  4.94287e-01,  3.49561e+00,  1.13715e+01, -3.31022e+01,  1.33886e+01, -6.12239e+01,  2.80243e+01, -4.72984e+01, -7.62829e+00, -1.78014e+01, -4.21388e+00,
         -2.95260e+01, -3.21905e+01, -1.16529e+01, -5.29988e+01, -6.24673e+01, -1.03640e+01, -3.64147e+01, -1.51883e+01, -6.05797e+01, -2.83153e+01, -3.96301e+01, -3.23183e+01, -4.70482e+01, -1.25914e+01, -1.25743e-01, -3.44447e+01,  3.01029e+01, -1.39026e+01, -3.09104e+01,  4.31240e+01, -2.26545e+01, -4.98257e+01,
          3.94724e+01, -3.62315e+01, -5.36994e+01,  9.84579e+00, -5.78797e+01,  8.88288e+00, -2.48423e+01, -6.02862e+01, -6.50976e+01, -1.66165e+01, -3.79517e+01, -2.36560e+01, -4.74364e+01, -3.53788e+01,  1.14016e+01,  4.95834e+00, -3.42425e+01,  3.03418e+01, -4.81642e+00,  7.14038e+01,  3.18278e+01,  1.07138e+01,
          1.01970e+01,  9.98044e+00, -1.08007e+01, -3.36774e+01, -3.64393e+01, -7.50058e+01, -3.40729e+01, -5.69791e+01, -5.18868e+01, -8.91326e+00,  1.56718e+01, -1.23594e+01,  1.77122e+01, -3.92818e+01, -7.66164e+01, -4.52037e+01, -4.15371e+01, -5.43199e+01,  5.11935e+01,  6.86084e+01,  5.38797e+01,  2.18248e+00,
          5.71205e+01, -1.77599e+01, -3.63288e+01,  4.65222e+01, -6.67484e+01, -4.93018e+01, -3.53012e+01, -8.36550e+01, -3.06433e+01,  6.15369e+01, -5.74722e+00,  3.88518e+01,  2.85106e+01, -6.21843e+01, -8.03142e+01, -2.73140e+01, -2.73175e+00,  2.22426e+01, -7.11857e+01, -8.98611e+01, -2.50441e+01,  7.48690e+00,
         -2.27219e+01, -6.91085e+01, -3.11809e+01, -2.38013e+01, -2.33840e+01, -9.77098e+01, -4.01707e+01, -5.70030e+01, -5.51492e+01,  1.05906e+01, -4.87839e+01, -4.47249e+01, -6.06707e+01, -7.02489e+01, -6.48262e+01, -7.77057e+01, -3.45044e+01, -1.91967e+01,  1.16562e+01,  5.08802e+01,  1.79616e+01,  4.39807e+01,
         -8.15045e+01, -5.78407e+01, -8.42298e+00, -7.65482e+01, -6.95861e+01, -8.92994e+01, -3.63493e+01, -1.61881e+01, -2.58950e+01, -9.03367e+01,  6.85503e+01, -4.15094e+01, -3.33513e+01, -9.77400e+00, -6.70880e+01, -2.54470e+01, -3.11859e+01, -8.28188e+01, -9.82167e+00, -1.21429e+02, -7.72672e+01, -8.06401e+01,
         -6.35301e+01, -9.50018e+01, -4.67265e+01, -1.78465e+01, -6.94347e+01,  3.00264e+00, -1.66941e+01, -2.01051e+01, -5.33888e+01, -6.81788e+01, -5.60458e+01, -4.97448e+01, -5.16750e+01, -4.34256e+01, -8.66348e+01, -5.81967e+01, -9.72425e+01, -8.97511e+01, -3.52029e+01,  6.76791e+01,  6.72519e+00,  5.42633e+01,
         -4.48836e+01, -3.39849e+01, -3.06384e+01,  5.03462e+01, -8.61406e+01, -6.32241e+01, -1.17983e+02, -2.35540e+01, -2.67308e+01, -1.09991e+01, -2.39504e+01, -7.00905e+01, -1.08702e+02, -1.87209e+02, -6.25029e+01,  1.09384e+01, -1.48487e+02, -1.09030e+02, -1.71221e+02, -1.62808e+02, -9.39098e+01, -1.45997e+02,
         -4.97233e+01, -2.57747e+01, -3.96143e+01,  6.91976e+00,  4.11655e+00, -3.61876e+01, -5.01774e+01, -4.32431e+01, -6.27164e+01, -5.58861e+01, -3.17808e+01, -7.71373e+01, -1.15020e+01, -2.98423e+01, -6.12077e+01, -3.60738e+01, -1.28906e+01, -5.64320e+01, -3.67780e+00,  9.82621e+00, -4.81847e+01, -6.82802e+01,
         -1.17636e+01, -6.02605e+01, -6.69872e+01,  3.17958e+01, -1.06279e+02, -9.14429e+01,  2.09143e+01,  4.98592e+00,  7.59257e+01,  1.19945e+01, -1.20432e+02, -2.05334e+01, -1.06085e+02, -6.15598e+00, -7.54594e+01,  1.94283e+01,  5.31406e+01, -2.05209e+01,  4.15064e+01, -2.80488e+01,  2.68630e+01,  5.43032e+01,
          8.06797e+00,  8.65958e+01,  1.31879e+02,  6.83681e+01, -2.35166e+01, -2.09904e+01,  4.48854e+01, -3.91279e+01,  6.91294e+01, -4.84164e+00,  5.78190e+01, -2.54663e+01, -7.45026e+01,  1.10348e+02, -1.35321e+02,  9.12665e+00,  1.09172e+02,  1.66936e+01, -1.41120e+01, -1.51037e+01, -2.17535e+01,  1.56495e+02,
          1.74281e+01,  5.69518e+01,  2.04882e+01,  1.01685e+02, -1.08566e+01, -1.89942e+00, -2.34808e+01, -3.53040e+01,  4.44154e+01,  1.13183e+02, -5.38659e+01,  2.14862e+01,  1.11103e+01, -5.43486e+01,  5.64432e+01,  3.94627e+01,  3.74569e+01,  5.95895e+01, -4.47065e+01,  6.78498e+01, -2.99796e+01,  9.94834e+01,
          1.03001e+02,  8.73152e+01,  3.16517e+00, -7.06114e+00, -1.02302e+02,  1.71886e+00,  4.51296e+00,  1.24154e+01, -1.24617e+02, -7.85287e+01, -1.92825e+02,  9.37257e+01,  2.78896e+01, -1.63450e+00, -4.84559e+01,  7.57744e+01,  3.94233e+01,  8.28954e+00,  2.27665e+01,  8.11777e+01, -2.86799e+01,  4.36652e+01,
          3.86338e+01,  5.24808e+01,  7.19110e+01, -1.24590e+01, -4.95899e+01,  3.67124e+01,  2.02164e+01,  1.00357e+02,  1.90697e+02,  2.27240e+01, -4.48891e+01, -6.25922e+01,  6.02001e+01,  6.70650e+01,  2.62409e+00,  1.70522e+01,  1.42687e+01, -5.11507e+01,  4.15503e+01, -8.25146e+00,  5.42502e+00, -2.10862e+01,
         -6.21062e+01,  6.12354e+01, -1.57139e+01,  1.13792e+01,  1.14598e+02,  5.04276e+01,  6.48856e+01, -3.51378e+01,  4.41353e+00,  3.98494e+01,  6.09775e+01, -2.08448e+01,  6.09574e+01,  1.36327e+01,  9.98023e+01,  3.30361e+01, -1.41564e+02,  2.04706e+01,  4.90794e+01,  6.57018e+01,  8.76122e+01,  4.28861e+01,
          1.12778e+02,  1.74388e+01,  5.89811e+01, -6.00783e+01,  1.22876e+00, -7.94701e+01, -4.89696e+01,  3.63641e+01, -1.49398e+01,  5.40424e+01, -4.97902e+01,  7.59017e+00,  7.80410e+01,  1.94663e+00, -2.07763e+01, -2.66542e+01,  7.01801e+01,  4.28601e+01,  3.08332e+01, -2.37795e+01,  3.94289e+01,  4.23950e+01,
          5.33235e+01,  2.33660e+01,  2.14558e+02,  7.06329e+01, -2.34228e+01, -1.21634e+01, -8.42133e+00, -1.29252e+01,  3.96827e+01, -1.20489e+02,  1.23052e+02,  2.57285e+01, -4.62837e+01, -1.08864e+00,  2.10573e+01,  2.65765e+01,  8.65960e+01,  1.74522e+01, -5.40542e+00, -1.24414e+02,  1.82291e+01,  4.67384e+01,
          8.68839e+00,  3.44258e+01,  9.17253e+01, -3.31096e+01,  1.59904e+01, -4.35329e+00,  2.14891e+02,  9.03524e-01, -1.79483e+01,  4.98993e+00,  1.72497e+01, -1.42652e+01,  1.25782e+02,  2.37108e+01,  9.73974e+01, -7.87078e+01,  7.14588e+00,  5.80331e+01,  1.49937e+01, -3.18162e+01,  1.32363e+02, -3.31656e+01,
          7.63196e+01, -7.24101e+01,  1.69486e+01, -8.92546e+01,  1.06463e+01,  7.39476e+01,  2.03292e+01,  3.34933e+01, -7.92790e+00,  2.68145e+00,  2.95363e+01,  9.00318e+00,  2.60829e+01,  7.87928e+01, -7.50336e+01,  2.26781e+01,  5.15145e+01,  1.77189e+01,  5.13755e+01,  1.81083e+01,  8.20387e+01,  2.64443e+01,
          2.20937e+01, -4.64859e+01, -1.92470e+00, -8.50255e+01,  1.40121e+02,  6.70406e+01,  5.53284e+01,  4.59101e+01, -2.55522e+01, -5.34055e+01,  8.91065e+01,  4.80408e+01,  1.47186e+01,  9.47634e+01,  9.05984e+01,  6.57296e+00,  3.42497e+01, -3.61163e+01, -7.94501e+01,  1.02553e+02, -2.79642e+01,  9.00697e+01,
          8.59592e+01,  3.56940e+01, -1.26030e+01,  2.24901e+02,  5.84089e+01, -5.66246e+01,  3.52551e+01,  4.30427e+01, -2.32605e+01, -4.30832e+01,  1.09244e+02, -6.55338e+01,  8.68172e+01,  6.80457e+01, -3.29982e+01,  6.93441e+01,  1.54439e+02,  5.03983e+01, -9.01554e+01,  6.97926e+01,  8.12630e+01, -7.79048e+00,
          1.05970e+02,  5.79573e+01, -3.95522e+01,  3.16581e+01, -2.89503e+01,  7.16994e+01,  1.88116e+02, -3.76823e+01,  7.18883e+01,  1.83263e+01,  4.15692e+00,  1.10292e+01,  1.01805e+02,  1.26041e+02,  1.98002e+01, -4.60546e+00, -6.82684e+01,  1.14628e+02,  1.34888e+01,  8.46530e+01,  3.38397e+01,  1.18186e+02,
         -4.14488e+01, -1.01182e+02,  7.52419e+01, -2.08133e+01,  1.12875e+02, -3.22475e+01,  2.47755e+01, -2.57023e+00,  7.74780e+01,  9.76051e+01, -2.18845e+01, -4.29446e+01, -3.83544e+01,  5.64655e+01, -2.13753e+00, -5.30397e+01, -8.08432e+01,  1.76507e+01,  8.38586e+01,  1.09498e+02, -3.62132e+01,  4.31095e+01,
          7.00742e+01,  4.81153e+01,  4.60655e+01,  7.50927e+01,  3.89688e+01, -6.30932e-02,  1.81564e+02,  3.92633e+01, -1.19136e+02,  1.96597e+01,  7.14377e+01,  1.70606e+01,  3.31662e+01, -8.25689e+00,  3.13732e+01, -1.56949e+01,  6.16064e+01,  2.78976e+01,  6.68415e+01, -1.81408e+01, -2.70050e+01,  6.75044e+01,
          9.65990e+00, -7.83630e+01,  5.08805e+01, -1.23272e+00,  1.04761e+02,  5.46885e+01,  1.69869e+01,  1.10403e+02,  1.04286e+02, -3.46241e+01,  7.38077e+01, -2.28996e+01,  1.59958e+01, -7.72255e+01,  1.28920e+02, -5.04042e+00,  4.25395e+00,  1.21051e+02,  5.68087e+01,  1.39567e+01, -5.34529e+01,  5.89874e+01,
         -6.39222e+01,  1.06694e+02,  1.91717e+01,  7.63441e+01, -7.10829e+01,  3.61836e+01,  3.36580e+01,  1.08488e+02, -3.03611e+01,  2.73946e-01,  1.54706e+01,  8.19758e+01, -2.88274e+01, -4.61100e+01,  2.29071e+01,  1.40623e+01,  2.23344e+00, -2.79020e+01,  4.98184e+01,  8.72834e+01,  2.52213e+01,  3.85043e+01,
          6.76158e+01,  3.19524e+01,  2.36705e+01, -4.75326e+01, -1.02847e+01,  4.45230e+01,  7.17564e+01, -4.45499e+01,  8.48650e+00, -3.87303e+01,  8.20294e+01,  5.09183e+01,  8.92060e-01, -6.71507e+00,  4.52952e+01, -5.30349e+00,  4.87571e+01,  1.68840e+01,  4.30549e+01,  1.25946e+01,  5.76475e+01,  4.73866e+01,
         -7.27343e+00,  5.48937e+01,  1.07048e+01,  5.72170e+01, -5.29833e+01,  4.09160e+01, -1.22325e+01,  3.70176e+01,  9.40179e+01,  7.39141e+00, -2.73665e+01,  9.61306e+01,  1.38850e+02,  5.58033e+01,  3.11396e+01,  1.25069e+02, -3.26505e+01,  8.51444e+01, -2.60036e+01,  4.62526e+01, -1.98865e+01, -4.58764e+00,
         -3.14065e+01,  2.62907e+01,  1.28426e+02, -6.56936e+01,  4.00425e+01,  3.99381e+01,  2.42202e+00,  7.74915e+01,  2.05551e+01,  5.94021e+01,  5.74201e-01,  2.83726e+01,  6.80231e+00,  1.20918e+01,  7.39908e+01, -2.02049e+01,  6.58996e+01,  3.75067e+01,  1.60293e+01,  1.93659e+02,  1.55331e+02, -3.34003e+01,
         -4.67908e+01,  9.80586e+01, -7.43240e+01, -4.14251e+01,  1.81267e+02,  3.63404e+01, -7.42197e+01,  1.90912e+01,  7.17733e+00,  1.77013e+01,  8.12707e+01, -5.73774e+01,  3.67493e+01,  2.33414e+02,  9.96200e+01, -3.38716e+01, -2.73119e+01,  5.99782e+01,  1.20523e+01, -2.94984e+01,  5.51856e+01,  1.31747e+01,
          6.08061e+01,  6.92710e+01,  6.38939e+01,  8.22402e+01,  1.19956e+01,  9.94230e+01,  8.20894e+01, -1.95278e+01,  1.34057e+02,  5.41856e+01,  1.42265e+02, -5.49581e+01,  7.45591e+00,  3.92571e+01, -3.79180e+01,  8.98320e+01,  5.39865e+01, -3.01589e+01,  1.49947e+02,  3.65906e+01, -5.85278e+01,  5.64600e+01,
         -6.68376e+01,  4.93028e+01,  3.95632e+01,  2.28967e+01,  1.60320e+02, -7.30020e+01, -2.51610e+01, -4.78122e+01, -7.74144e+00,  5.53322e+00,  1.40763e+02,  4.46116e+01, -1.26229e+02, -1.82600e+01,  1.01777e+02,  2.25278e+01, -7.61144e+01, -5.72783e+00,  3.74589e+01,  3.62306e+01,  2.59262e+01,  1.03397e+02,
          1.06137e+01, -2.35500e+01,  9.26027e+01,  1.04309e+02,  7.52346e+01,  8.87079e+01,  5.96886e+01, -4.09386e+01,  2.39261e+01, -3.41942e+01, -2.05487e+01, -2.42697e+01,  7.23957e+01,  2.12629e+01,  4.78991e+01, -1.75471e+01,  8.94890e+01,  8.00702e+01,  1.04252e+02,  6.47424e+01,  4.57684e+01, -1.82341e+01,
          9.91363e+00,  7.35354e+01,  1.39169e+02,  1.12581e+02,  2.02250e+01,  1.10136e+02,  7.23758e+01,  9.61818e+01, -4.99173e+00,  5.36082e+01,  7.87210e+00, -1.86572e+00, -1.23703e+02, -1.76746e+01,  4.10450e+01,  4.01796e+01, -3.62259e-01,  1.59524e+01,  1.93180e+02,  7.51985e+01, -2.15383e+00,  3.70978e+01,
          3.21482e+01,  4.68791e+01,  1.29375e-01, -3.67392e+01,  1.22000e+01,  1.50920e+01,  5.90128e+00, -3.44447e+00, -1.25480e+01, -2.68047e+01, -2.54337e-01,  7.11901e+01, -2.70735e+01,  6.50999e+01,  6.44314e+01,  2.95288e+01, -5.47505e+01, -2.64763e+01, -5.88463e+01,  4.93606e+01, -5.81526e+01, -2.70228e+01,
         -7.30128e+01,  1.26390e+01,  2.96668e+01, -2.78257e+01,  1.04246e+02,  5.17171e+01, -4.32255e+01, -3.48244e+01,  8.32739e+00, -7.43120e+01, -1.02236e+02, -3.07126e+01, -3.15968e+01,  2.25043e+00,  2.39252e+01, -2.77717e+01,  5.34968e+01,  3.08335e+00,  2.54286e+01, -1.24258e+00,  7.28492e+01,  4.01145e+01,
          1.41846e+02,  1.76889e+01, -5.42440e+01,  4.94889e+01, -1.56842e+01,  3.10288e+01, -1.20050e+01,  3.07456e+01,  8.96710e+00, -1.34524e+00,  2.86576e+01, -1.31128e+01,  1.12463e+02, -4.11702e+01, -1.29178e+00,  5.04744e+01, -8.50203e+01, -5.84282e+01, -6.84366e+01,  2.84956e+01, -3.68073e+01, -3.02600e+01,
         -5.56722e+01,  2.39412e+00, -4.94293e+01, -1.11265e+02, -5.41824e+01, -7.71478e+01, -7.13178e+01, -4.73012e+00,  5.08523e+00,  1.70172e+01], device='cuda:0')]

I wouldn't say that's a very useful output neither :)

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

@SkalskiP okay.. So should we post process this and output only probabilities?
EDIT: I'm actually not sure what's most useful classification output would be.....

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

@AyushExel what is the post-processing flow right now? If I get that result what can I do myself right now to make it more human-readable? IS there any method in the pip package that I can use?

from ultralytics.

glenn-jocher avatar glenn-jocher commented on May 13, 2024

@SkalskiP YOLOv5 hub models handle this with Detections objects that then have many methods like results.show(), results.print() etc. we’d like to do something similar here but just haven’t had time. In that plan the raw tensor outputs are also available as ie results.raw

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

You can run it through softmax or just argmax to get the class id and then if you have imagenet id_to_name mapping you can display the name of the class. This is what v5 does by default

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

I started the work on train-yolov8-classification-on-custom-dataset tutorial. That one is still missing in Roboflow Notebooks, but in the current state, it is pretty hard to do that.

I think that You can run it through softmax or just argmax to get the class id and then if you have imagenet id_to_name mapping you can display the name of the class. is a bit too much of a headache for average Joe.

I stand with @glenn-jocher. All around the model should be easy to use and offer those methods out of the box.

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

yes that works well for the default case(imagenet models) which is what we should be doing.. But I'm still not understanding how can we make this a global feature..
preds = model(imgs) # -> this should still return model predictions..not the detected class names right? I was mostly confused about whether it should return raw logits or probabilities .. But you'd like the class names directly?

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

Take a look here: https://www.tensorflow.org/tutorials/keras/classification. Usually, you get a 1D vector. Where all values in the vector sum up to 1. Interpretation is that the index of the value in the vector corresponds to the index in the class names list.

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

That sounds reasonable to me πŸ‘πŸ»

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

Okay @SkalskiP what do you think about the detection and segmentation output formats? Please take a look there also.
We currently have them like this:
detection - List[nxTensor[]] - one 1x6 tensor for each of the n images
segmentation - List[nx[Tensor, Tensor]] - Here output of each image itself is a list of 2 tensors, 1st is the detection part and 2nd is the segmentation mask

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

@AyushExel I'm going live on Twitch and LinkedIn in over 1h. I'll be playing around with all models. I'll try to understand what people expect and give you some feedback today or tomorrow :)

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

@SkalskiP okay perfect! thanks

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

@AyushExel I like object detection and instance segmentation output. The only one that is off is classification. πŸ‘πŸ»

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

@AyushExel and @glenn-jocher there is also the question of training results for classification. runs/classify/train directory contains only those files:

total 1772
drwxr-xr-x 3 root root    4096 Jan 11 11:17 .
drwxr-xr-x 4 root root    4096 Jan 11 11:16 ..
-rw-r--r-- 1 root root    1349 Jan 11 11:16 args.yaml
-rw-r--r-- 1 root root 1779440 Jan 11 11:55 events.out.tfevents.1673435799.8e76317367da.792.0
-rw-r--r-- 1 root root    9792 Jan 11 11:55 results.csv
drwxr-xr-x 2 root root    4096 Jan 11 11:17 weights

Would be cool to have a confusion matrix and loss charts like with other tasks.

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

yeah @SkalskiP we realized yesterday that cls needs a lot more work than we thought.. After putting up some stats for the readme, we'll get to that and try to bring all detection and segmentation features there.

from ultralytics.

SkalskiP avatar SkalskiP commented on May 13, 2024

@AyushExel is that okay if I'll add other things that I notice during tests of that task in that issue? Of course, it is not to put pressure on you or the rest of the team. I understand that segmentation is the least important of them all. Just to keep track of everything.

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

@SkalskiP yes of course. This is invaluable feedback and we'll address it as soon as we can. I appreciate the effort you're putting into this. btw segmentation is not the least important for us :) but maybe you meant classification

from ultralytics.

AI-P-K avatar AI-P-K commented on May 13, 2024

@SkalskiP How did you managed to get that tensor returned? For the same code
model = YOLO('yolov8n-cls.pt')
results = model.predict(source='https://media.roboflow.com/notebooks/examples/dog.jpeg', conf=0.25)
print(results)
I get
<generator object BasePredictor.call at 0x7fa6c1097610>

How can I "unpack" this?

from ultralytics.

dmddmd avatar dmddmd commented on May 13, 2024

@Laughing-q hey, what is the current state?
I just upgraded ultralytics to version 8.0.11 , but it seems like the docs are not up-to-date.
I am trying to get the results of the detection with the pretrained models.
As described in the docs, I run:

results = model(source=0, stream="True") # Generator of Results objects
for result in results:
    probs = results.probs # why results and not result? result.probs also throws Attribute Error
    # boxes = results.boxes # Boxes object for bbox outputs
   

But I get

AttributeError: 'generator' object has no attribute 'probs' / 'boxes'

(should I open a new issue?)

from ultralytics.

Laughing-q avatar Laughing-q commented on May 13, 2024

@dmddmd hi, actually I think you should do:
probs = result.probs

rather than probs = results.probs.

from ultralytics.

dmddmd avatar dmddmd commented on May 13, 2024

@dmddmd hi, actually I think you should do: probs = result.probs

rather than probs = results.probs.

AttributeError: 'list' object has no attribute 'probs'

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

Results is a list where each item of the list contains result for each frame. Do results [0].probs

from ultralytics.

dmddmd avatar dmddmd commented on May 13, 2024

Maybe I'm missing sth.

model = YOLO('yolov8n.pt')
results = model(source=0, stream="True")  

print(results [0].probs)
print(results [0].probs)  -> TypeError: 'generator' object is not subscriptable 

with a jpg-file, there is an output, but with the camera it gives the TypeError

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

@dmddmd you're using stream mode so the return type will be a generator.
you'll need to loop through the results.

result = model("0", stream=True)
for res in results:
     res.boxes
     ...

If you're not using stream mode, the returned value will be a list of Results object where each element of the list will contain the result of 1 frame.

result = model("img.jpg")
result[0].boxes

The docs have clear example and explanations here, please check it out - https://docs.ultralytics.com/predict/

from ultralytics.

dmddmd avatar dmddmd commented on May 13, 2024

yes sorry, forgot to change it. It still throws an error.

  model = YOLO('yolov8n.pt')    # pretrained model
  
  results = model("0", stream=True)
  for res in results:
      res.boxes

AttributeError: 'list' object has no attribute 'boxes'

from ultralytics.

dmddmd avatar dmddmd commented on May 13, 2024

@AyushExel many thanks.
But 'til then , I can't work with the following?

  for res in results:
       for r in res:  #try for ultralytics v8.0.11 
           print(r.boxes)

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

Yeah you can

from ultralytics.

dmddmd avatar dmddmd commented on May 13, 2024

r.boxes works but r.probs and r.masks give 'None'

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

Are you using segmentation model?

from ultralytics.

AyushExel avatar AyushExel commented on May 13, 2024

Guys detection task won't have probs. Same for masks. Detection outputs bounding boxes that's why probs and masks are empty.
Cls - probs
Detection - boxes
Segmentation - boxes, masks

from ultralytics.

cip8 avatar cip8 commented on May 13, 2024

Hey guys and thanks for this new version of YOLO ❀️

In my case the classifier shows 0.00% probabilities for all labels:

bus

Am I doing something wrong, or is this still a work in progress atm?

from ultralytics.

shumshersubashgautam avatar shumshersubashgautam commented on May 13, 2024

@glenn-jocher How we can plot the confusion matrix, F1 curve,pr curve, etc on classification models??? as of detection models default just saved weights and results.csv file. I need all these metrics plots on classification models by default how we can plot any code and tutorial please suggest for the classification model.

from ultralytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.