ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
48.83k stars 15.95k forks source link

yolov5s-cls.engine names error #12125

Closed jo-dean closed 9 months ago

jo-dean commented 10 months ago

Search before asking

YOLOv5 Component

No response

Bug

**when i run python export.py --weights yolov5s-cls.pt --include engine onnx --imgsz 224 i got yolov5s-cls.engine, but the model.names only have 80 classes. but the yolov5s-cls.pt has 1k classes.

and when i train cifar10, the engine file still 80 classes.**

Environment

No response

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 10 months ago

👋 Hello @jo-dean, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics
glenn-jocher commented 10 months ago

@jo-dean hi there 👋,

Thanks for reaching out and bringing this issue to our attention. It seems that when you export the yolov5s-cls.pt model to the yolov5s-cls.engine format using export.py, you're encountering an error where the generated model.names file only contains 80 classes, even though the original yolov5s-cls.pt model has 1k classes.

To better assist you with this issue, we would appreciate it if you could provide the following information:

  1. The exact steps or commands you used to train the yolov5s-cls.pt model with 1k classes.
  2. Any modifications or customizations you made to the code or configuration files before running the export command.
  3. The version of YOLOv5 that you are using.
  4. Any other relevant information about your environment, such as the operating system and CUDA/CUDNN versions.

Additionally, please ensure you have the latest version of YOLOv5 and PyTorch installed, as we regularly release updates that may address this issue.

Once we have more information, we'll be able to assist you further in resolving this problem. Thank you for your understanding and patience.

jo-dean commented 10 months ago
  1. The version of yolov5 is 7.0
  2. CUDA version is 11.4 cudnn version is 8.4,pytorch version is torch-1.13.1+cu117
  3. the 1k-cls pt file is download from python export.py --weights yolov5s-cls.pt --include engine onnx --imgsz 224 1695000195816
  4. I trained cifar10 used command python classify/train.py --model yolov5s-cls.pt --data cifar10 --epoch 5 --img 224 --batch 128,and i got the 10-cls best.pt. it can predict correct.the dict of pt model.names has 10-cls. but when i run python export.py --weights run/train-cls/exp2/weights/best.pt --include engine onnx --imgsz 224 --device 0, the dict of engine model.names has 80-cls.
glenn-jocher commented 10 months ago

Thanks for providing the additional information, @jo-dean.

It seems that you have encountered an issue where the generated model.names file for the engine format only contains 80 classes, even though the original yolov5s-cls.pt file had 1k classes. Additionally, when you trained CIFAR10 using the command python classify/train.py --model yolov5s-cls.pt --data cifar10 --epoch 5 --img 224 --batch 128, you obtained the best.pt file with 10 classes. However, when using export.py to convert this best.pt file to the engine format, the generated model.names file still contains 80 classes.

For a solution to this issue, I would recommend checking the following:

  1. Ensure that the yolov5s-cls.pt file with 1k classes is correct and includes the desired classes. You can check the contents of the model.names file within the yolov5s-cls.pt file to verify this.
  2. Confirm that the CIFAR10 training process is correctly identifying and training with the 10 classes you expect.
  3. Double-check the command you are using to export the best.pt file and ensure it matches your requirements.

If you have already verified the above steps and are still encountering the issue, please provide the exact commands you used for training the yolov5s-cls.pt and best.pt models, as well as any relevant code modifications you made. Additionally, please let us know if you encountered any error messages during the export process.

This information will help us further investigate and provide you with a more accurate solution for the issue you're facing.

jo-dean commented 10 months ago

here is all my steps,and i did not change the code. 1.the yolov5s-cls.pt is automatic download from command python classify/predict.py --weights yolov5s-cls.pt --source ./data/images/bus.jpg `python classify/predict.py --weights yolov5s-cls.pt --source ./data/images/bus.jpg classify/predict: weights=['yolov5s-cls.pt'], source=./data/images/bus.jpg, data=data/coco128.yaml, imgsz=[224, 224], device=, view_img=False, save_txt=False, nosave=False, augment=False, visualize=False, update=False, project=runs/predict-cls, name=exp, exist_ok=False, half=False, dnn=False, vid_stride=1 YOLOv5 🚀 v7.0-185-g2334aa7 Python-3.8.17 torch-1.13.1+cu117 CUDA:0 (NVIDIA GeForce RTX 3090, 24252MiB)

Downloading https://github.com/ultralytics/yolov5/releases/download/v7.0/yolov5s-cls.pt to yolov5s-cls.pt... 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10.5M/10.5M [00:03<00:00, 2.85MB/s]

Fusing layers... Model summary: 117 layers, 5447688 parameters, 0 gradients, 11.4 GFLOPs here to print model names: names: {0: 'tench', 1: 'goldfish', 2: 'great white shark', 3: 'tiger shark', 4: 'hammerhead shark', 5: 'electric ray', 6: 'stingray', 7: 'cock', 8: 'hen', 9: 'ostrich', 10: 'brambling', 11: 'goldfinch', 12: 'house finch', 13: 'junco', 14: 'indigo bunting', 15: 'American robin', 16: 'bulbul', 17: 'jay', 18: 'magpie', 19: 'chickadee', 20: 'American dipper', 21: 'kite', 22: 'bald eagle', 23: 'vulture', 24: 'great grey owl', 25: 'fire salamander', 26: 'smooth newt', 27: 'newt', 28: 'spotted salamander', 29: 'axolotl', 30: 'American bullfrog', 31: 'tree frog', 32: 'tailed frog', 33: 'loggerhead sea turtle', 34: 'leatherback sea turtle', 35: 'mud turtle', 36: 'terrapin', 37: 'box turtle', 38: 'banded gecko', 39: 'green iguana', 40: 'Carolina anole', 41: 'desert grassland whiptail lizard', 42: 'agama', 43: 'frilled-necked lizard', 44: 'alligator lizard', 45: 'Gila monster', 46: 'European green lizard', 47: 'chameleon', 48: 'Komodo dragon', 49: 'Nile crocodile', 50: 'American alligator', 51: 'triceratops', 52: 'worm snake', 53: 'ring-necked snake', 54: 'eastern hog-nosed snake', 55: 'smooth green snake', 56: 'kingsnake', 57: 'garter snake', 58: 'water snake', 59: 'vine snake', 60: 'night snake', 61: 'boa constrictor', 62: 'African rock python', 63: 'Indian cobra', 64: 'green mamba', 65: 'sea snake', 66: 'Saharan horned viper', 67: 'eastern diamondback rattlesnake', 68: 'sidewinder', 69: 'trilobite', 70: 'harvestman', 71: 'scorpion', 72: 'yellow garden spider', 73: 'barn spider', 74: 'European garden spider', 75: 'southern black widow', 76: 'tarantula', 77: 'wolf spider', 78: 'tick', 79: 'centipede', 80: 'black grouse', 81: 'ptarmigan', 82: 'ruffed grouse', 83: 'prairie grouse', 84: 'peacock', 85: 'quail', 86: 'partridge', 87: 'grey parrot', 88: 'macaw', 89: 'sulphur-crested cockatoo', 90: 'lorikeet', 91: 'coucal', 92: 'bee eater', 93: 'hornbill', 94: 'hummingbird', 95: 'jacamar', 96: 'toucan', 97: 'duck', 98: 'red-breasted merganser', 99: 'goose', 100: 'black swan', 101: 'tusker', 102: 'echidna', 103: 'platypus', 104: 'wallaby', 105: 'koala', 106: 'wombat', 107: 'jellyfish', 108: 'sea anemone', 109: 'brain coral', 110: 'flatworm', 111: 'nematode', 112: 'conch', 113: 'snail', 114: 'slug', 115: 'sea slug', 116: 'chiton', 117: 'chambered nautilus', 118: 'Dungeness crab', 119: 'rock crab', 120: 'fiddler crab', 121: 'red king crab', 122: 'American lobster', 123: 'spiny lobster', 124: 'crayfish', 125: 'hermit crab', 126: 'isopod', 127: 'white stork', 128: 'black stork', 129: 'spoonbill', 130: 'flamingo', 131: 'little blue heron', 132: 'great egret', 133: 'bittern', 134: 'crane (bird)', 135: 'limpkin', 136: 'common gallinule', 137: 'American coot', 138: 'bustard', 139: 'ruddy turnstone', 140: 'dunlin', 141: 'common redshank', 142: 'dowitcher', 143: 'oystercatcher', 144: 'pelican', 145: 'king penguin', 146: 'albatross', 147: 'grey whale', 148: 'killer whale', 149: 'dugong', 150: 'sea lion', 151: 'Chihuahua', 152: 'Japanese Chin', 153: 'Maltese', 154: 'Pekingese', 155: 'Shih Tzu', 156: 'King Charles Spaniel', 157: 'Papillon', 158: 'toy terrier', 159: 'Rhodesian Ridgeback', 160: 'Afghan Hound', 161: 'Basset Hound', 162: 'Beagle', 163: 'Bloodhound', 164: 'Bluetick Coonhound', 165: 'Black and Tan Coonhound', 166: 'Treeing Walker Coonhound', 167: 'English foxhound', 168: 'Redbone Coonhound', 169: 'borzoi', 170: 'Irish Wolfhound', 171: 'Italian Greyhound', 172: 'Whippet', 173: 'Ibizan Hound', 174: 'Norwegian Elkhound', 175: 'Otterhound', 176: 'Saluki', 177: 'Scottish Deerhound', 178: 'Weimaraner', 179: 'Staffordshire Bull Terrier', 180: 'American Staffordshire Terrier', 181: 'Bedlington Terrier', 182: 'Border Terrier', 183: 'Kerry Blue Terrier', 184: 'Irish Terrier', 185: 'Norfolk Terrier', 186: 'Norwich Terrier', 187: 'Yorkshire Terrier', 188: 'Wire Fox Terrier', 189: 'Lakeland Terrier', 190: 'Sealyham Terrier', 191: 'Airedale Terrier', 192: 'Cairn Terrier', 193: 'Australian Terrier', 194: 'Dandie Dinmont Terrier', 195: 'Boston Terrier', 196: 'Miniature Schnauzer', 197: 'Giant Schnauzer', 198: 'Standard Schnauzer', 199: 'Scottish Terrier', 200: 'Tibetan Terrier', 201: 'Australian Silky Terrier', 202: 'Soft-coated Wheaten Terrier', 203: 'West Highland White Terrier', 204: 'Lhasa Apso', 205: 'Flat-Coated Retriever', 206: 'Curly-coated Retriever', 207: 'Golden Retriever', 208: 'Labrador Retriever', 209: 'Chesapeake Bay Retriever', 210: 'German Shorthaired Pointer', 211: 'Vizsla', 212: 'English Setter', 213: 'Irish Setter', 214: 'Gordon Setter', 215: 'Brittany', 216: 'Clumber Spaniel', 217: 'English Springer Spaniel', 218: 'Welsh Springer Spaniel', 219: 'Cocker Spaniels', 220: 'Sussex Spaniel', 221: 'Irish Water Spaniel', 222: 'Kuvasz', 223: 'Schipperke', 224: 'Groenendael', 225: 'Malinois', 226: 'Briard', 227: 'Australian Kelpie', 228: 'Komondor', 229: 'Old English Sheepdog', 230: 'Shetland Sheepdog', 231: 'collie', 232: 'Border Collie', 233: 'Bouvier des Flandres', 234: 'Rottweiler', 235: 'German Shepherd Dog', 236: 'Dobermann', 237: 'Miniature Pinscher', 238: 'Greater Swiss Mountain Dog', 239: 'Bernese Mountain Dog', 240: 'Appenzeller Sennenhund', 241: 'Entlebucher Sennenhund', 242: 'Boxer', 243: 'Bullmastiff', 244: 'Tibetan Mastiff', 245: 'French Bulldog', 246: 'Great Dane', 247: 'St. Bernard', 248: 'husky', 249: 'Alaskan Malamute', 250: 'Siberian Husky', 251: 'Dalmatian', 252: 'Affenpinscher', 253: 'Basenji', 254: 'pug', 255: 'Leonberger', 256: 'Newfoundland', 257: 'Pyrenean Mountain Dog', 258: 'Samoyed', 259: 'Pomeranian', 260: 'Chow Chow', 261: 'Keeshond', 262: 'Griffon Bruxellois', 263: 'Pembroke Welsh Corgi', 264: 'Cardigan Welsh Corgi', 265: 'Toy Poodle', 266: 'Miniature Poodle', 267: 'Standard Poodle', 268: 'Mexican hairless dog', 269: 'grey wolf', 270: 'Alaskan tundra wolf', 271: 'red wolf', 272: 'coyote', 273: 'dingo', 274: 'dhole', 275: 'African wild dog', 276: 'hyena', 277: 'red fox', 278: 'kit fox', 279: 'Arctic fox', 280: 'grey fox', 281: 'tabby cat', 282: 'tiger cat', 283: 'Persian cat', 284: 'Siamese cat', 285: 'Egyptian Mau', 286: 'cougar', 287: 'lynx', 288: 'leopard', 289: 'snow leopard', 290: 'jaguar', 291: 'lion', 292: 'tiger', 293: 'cheetah', 294: 'brown bear', 295: 'American black bear', 296: 'polar bear', 297: 'sloth bear', 298: 'mongoose', 299: 'meerkat', 300: 'tiger beetle', 301: 'ladybug', 302: 'ground beetle', 303: 'longhorn beetle', 304: 'leaf beetle', 305: 'dung beetle', 306: 'rhinoceros beetle', 307: 'weevil', 308: 'fly', 309: 'bee', 310: 'ant', 311: 'grasshopper', 312: 'cricket', 313: 'stick insect', 314: 'cockroach', 315: 'mantis', 316: 'cicada', 317: 'leafhopper', 318: 'lacewing', 319: 'dragonfly', 320: 'damselfly', 321: 'red admiral', 322: 'ringlet', 323: 'monarch butterfly', 324: 'small white', 325: 'sulphur butterfly', 326: 'gossamer-winged butterfly', 327: 'starfish', 328: 'sea urchin', 329: 'sea cucumber', 330: 'cottontail rabbit', 331: 'hare', 332: 'Angora rabbit', 333: 'hamster', 334: 'porcupine', 335: 'fox squirrel', 336: 'marmot', 337: 'beaver', 338: 'guinea pig', 339: 'common sorrel', 340: 'zebra', 341: 'pig', 342: 'wild boar', 343: 'warthog', 344: 'hippopotamus', 345: 'ox', 346: 'water buffalo', 347: 'bison', 348: 'ram', 349: 'bighorn sheep', 350: 'Alpine ibex', 351: 'hartebeest', 352: 'impala', 353: 'gazelle', 354: 'dromedary', 355: 'llama', 356: 'weasel', 357: 'mink', 358: 'European polecat', 359: 'black-footed ferret', 360: 'otter', 361: 'skunk', 362: 'badger', 363: 'armadillo', 364: 'three-toed sloth', 365: 'orangutan', 366: 'gorilla', 367: 'chimpanzee', 368: 'gibbon', 369: 'siamang', 370: 'guenon', 371: 'patas monkey', 372: 'baboon', 373: 'macaque', 374: 'langur', 375: 'black-and-white colobus', 376: 'proboscis monkey', 377: 'marmoset', 378: 'white-headed capuchin', 379: 'howler monkey', 380: 'titi', 381: "Geoffroy's spider monkey", 382: 'common squirrel monkey', 383: 'ring-tailed lemur', 384: 'indri', 385: 'Asian elephant', 386: 'African bush elephant', 387: 'red panda', 388: 'giant panda', 389: 'snoek', 390: 'eel', 391: 'coho salmon', 392: 'rock beauty', 393: 'clownfish', 394: 'sturgeon', 395: 'garfish', 396: 'lionfish', 397: 'pufferfish', 398: 'abacus', 399: 'abaya', 400: 'academic gown', 401: 'accordion', 402: 'acoustic guitar', 403: 'aircraft carrier', 404: 'airliner', 405: 'airship', 406: 'altar', 407: 'ambulance', 408: 'amphibious vehicle', 409: 'analog clock', 410: 'apiary', 411: 'apron', 412: 'waste container', 413: 'assault rifle', 414: 'backpack', 415: 'bakery', 416: 'balance beam', 417: 'balloon', 418: 'ballpoint pen', 419: 'Band-Aid', 420: 'banjo', 421: 'baluster', 422: 'barbell', 423: 'barber chair', 424: 'barbershop', 425: 'barn', 426: 'barometer', 427: 'barrel', 428: 'wheelbarrow', 429: 'baseball', 430: 'basketball', 431: 'bassinet', 432: 'bassoon', 433: 'swimming cap', 434: 'bath towel', 435: 'bathtub', 436: 'station wagon', 437: 'lighthouse', 438: 'beaker', 439: 'military cap', 440: 'beer bottle', 441: 'beer glass', 442: 'bell-cot', 443: 'bib', 444: 'tandem bicycle', 445: 'bikini', 446: 'ring binder', 447: 'binoculars', 448: 'birdhouse', 449: 'boathouse', 450: 'bobsleigh', 451: 'bolo tie', 452: 'poke bonnet', 453: 'bookcase', 454: 'bookstore', 455: 'bottle cap', 456: 'bow', 457: 'bow tie', 458: 'brass', 459: 'bra', 460: 'breakwater', 461: 'breastplate', 462: 'broom', 463: 'bucket', 464: 'buckle', 465: 'bulletproof vest', 466: 'high-speed train', 467: 'butcher shop', 468: 'taxicab', 469: 'cauldron', 470: 'candle', 471: 'cannon', 472: 'canoe', 473: 'can opener', 474: 'cardigan', 475: 'car mirror', 476: 'carousel', 477: 'tool kit', 478: 'carton', 479: 'car wheel', 480: 'automated teller machine', 481: 'cassette', 482: 'cassette player', 483: 'castle', 484: 'catamaran', 485: 'CD player', 486: 'cello', 487: 'mobile phone', 488: 'chain', 489: 'chain-link fence', 490: 'chain mail', 491: 'chainsaw', 492: 'chest', 493: 'chiffonier', 494: 'chime', 495: 'china cabinet', 496: 'Christmas stocking', 497: 'church', 498: 'movie theater', 499: 'cleaver', 500: 'cliff dwelling', 501: 'cloak', 502: 'clogs', 503: 'cocktail shaker', 504: 'coffee mug', 505: 'coffeemaker', 506: 'coil', 507: 'combination lock', 508: 'computer keyboard', 509: 'confectionery store', 510: 'container ship', 511: 'convertible', 512: 'corkscrew', 513: 'cornet', 514: 'cowboy boot', 515: 'cowboy hat', 516: 'cradle', 517: 'crane (machine)', 518: 'crash helmet', 519: 'crate', 520: 'infant bed', 521: 'Crock Pot', 522: 'croquet ball', 523: 'crutch', 524: 'cuirass', 525: 'dam', 526: 'desk', 527: 'desktop computer', 528: 'rotary dial telephone', 529: 'diaper', 530: 'digital clock', 531: 'digital watch', 532: 'dining table', 533: 'dishcloth', 534: 'dishwasher', 535: 'disc brake', 536: 'dock', 537: 'dog sled', 538: 'dome', 539: 'doormat', 540: 'drilling rig', 541: 'drum', 542: 'drumstick', 543: 'dumbbell', 544: 'Dutch oven', 545: 'electric fan', 546: 'electric guitar', 547: 'electric locomotive', 548: 'entertainment center', 549: 'envelope', 550: 'espresso machine', 551: 'face powder', 552: 'feather boa', 553: 'filing cabinet', 554: 'fireboat', 555: 'fire engine', 556: 'fire screen sheet', 557: 'flagpole', 558: 'flute', 559: 'folding chair', 560: 'football helmet', 561: 'forklift', 562: 'fountain', 563: 'fountain pen', 564: 'four-poster bed', 565: 'freight car', 566: 'French horn', 567: 'frying pan', 568: 'fur coat', 569: 'garbage truck', 570: 'gas mask', 571: 'gas pump', 572: 'goblet', 573: 'go-kart', 574: 'golf ball', 575: 'golf cart', 576: 'gondola', 577: 'gong', 578: 'gown', 579: 'grand piano', 580: 'greenhouse', 581: 'grille', 582: 'grocery store', 583: 'guillotine', 584: 'barrette', 585: 'hair spray', 586: 'half-track', 587: 'hammer', 588: 'hamper', 589: 'hair dryer', 590: 'hand-held computer', 591: 'handkerchief', 592: 'hard disk drive', 593: 'harmonica', 594: 'harp', 595: 'harvester', 596: 'hatchet', 597: 'holster', 598: 'home theater', 599: 'honeycomb', 600: 'hook', 601: 'hoop skirt', 602: 'horizontal bar', 603: 'horse-drawn vehicle', 604: 'hourglass', 605: 'iPod', 606: 'clothes iron', 607: "jack-o'-lantern", 608: 'jeans', 609: 'jeep', 610: 'T-shirt', 611: 'jigsaw puzzle', 612: 'pulled rickshaw', 613: 'joystick', 614: 'kimono', 615: 'knee pad', 616: 'knot', 617: 'lab coat', 618: 'ladle', 619: 'lampshade', 620: 'laptop computer', 621: 'lawn mower', 622: 'lens cap', 623: 'paper knife', 624: 'library', 625: 'lifeboat', 626: 'lighter', 627: 'limousine', 628: 'ocean liner', 629: 'lipstick', 630: 'slip-on shoe', 631: 'lotion', 632: 'speaker', 633: 'loupe', 634: 'sawmill', 635: 'magnetic compass', 636: 'mail bag', 637: 'mailbox', 638: 'tights', 639: 'tank suit', 640: 'manhole cover', 641: 'maraca', 642: 'marimba', 643: 'mask', 644: 'match', 645: 'maypole', 646: 'maze', 647: 'measuring cup', 648: 'medicine chest', 649: 'megalith', 650: 'microphone', 651: 'microwave oven', 652: 'military uniform', 653: 'milk can', 654: 'minibus', 655: 'miniskirt', 656: 'minivan', 657: 'missile', 658: 'mitten', 659: 'mixing bowl', 660: 'mobile home', 661: 'Model T', 662: 'modem', 663: 'monastery', 664: 'monitor', 665: 'moped', 666: 'mortar', 667: 'square academic cap', 668: 'mosque', 669: 'mosquito net', 670: 'scooter', 671: 'mountain bike', 672: 'tent', 673: 'computer mouse', 674: 'mousetrap', 675: 'moving van', 676: 'muzzle', 677: 'nail', 678: 'neck brace', 679: 'necklace', 680: 'nipple', 681: 'notebook computer', 682: 'obelisk', 683: 'oboe', 684: 'ocarina', 685: 'odometer', 686: 'oil filter', 687: 'organ', 688: 'oscilloscope', 689: 'overskirt', 690: 'bullock cart', 691: 'oxygen mask', 692: 'packet', 693: 'paddle', 694: 'paddle wheel', 695: 'padlock', 696: 'paintbrush', 697: 'pajamas', 698: 'palace', 699: 'pan flute', 700: 'paper towel', 701: 'parachute', 702: 'parallel bars', 703: 'park bench', 704: 'parking meter', 705: 'passenger car', 706: 'patio', 707: 'payphone', 708: 'pedestal', 709: 'pencil case', 710: 'pencil sharpener', 711: 'perfume', 712: 'Petri dish', 713: 'photocopier', 714: 'plectrum', 715: 'Pickelhaube', 716: 'picket fence', 717: 'pickup truck', 718: 'pier', 719: 'piggy bank', 720: 'pill bottle', 721: 'pillow', 722: 'ping-pong ball', 723: 'pinwheel', 724: 'pirate ship', 725: 'pitcher', 726: 'hand plane', 727: 'planetarium', 728: 'plastic bag', 729: 'plate rack', 730: 'plow', 731: 'plunger', 732: 'Polaroid camera', 733: 'pole', 734: 'police van', 735: 'poncho', 736: 'billiard table', 737: 'soda bottle', 738: 'pot', 739: "potter's wheel", 740: 'power drill', 741: 'prayer rug', 742: 'printer', 743: 'prison', 744: 'projectile', 745: 'projector', 746: 'hockey puck', 747: 'punching bag', 748: 'purse', 749: 'quill', 750: 'quilt', 751: 'race car', 752: 'racket', 753: 'radiator', 754: 'radio', 755: 'radio telescope', 756: 'rain barrel', 757: 'recreational vehicle', 758: 'reel', 759: 'reflex camera', 760: 'refrigerator', 761: 'remote control', 762: 'restaurant', 763: 'revolver', 764: 'rifle', 765: 'rocking chair', 766: 'rotisserie', 767: 'eraser', 768: 'rugby ball', 769: 'ruler', 770: 'running shoe', 771: 'safe', 772: 'safety pin', 773: 'salt shaker', 774: 'sandal', 775: 'sarong', 776: 'saxophone', 777: 'scabbard', 778: 'weighing scale', 779: 'school bus', 780: 'schooner', 781: 'scoreboard', 782: 'CRT screen', 783: 'screw', 784: 'screwdriver', 785: 'seat belt', 786: 'sewing machine', 787: 'shield', 788: 'shoe store', 789: 'shoji', 790: 'shopping basket', 791: 'shopping cart', 792: 'shovel', 793: 'shower cap', 794: 'shower curtain', 795: 'ski', 796: 'ski mask', 797: 'sleeping bag', 798: 'slide rule', 799: 'sliding door', 800: 'slot machine', 801: 'snorkel', 802: 'snowmobile', 803: 'snowplow', 804: 'soap dispenser', 805: 'soccer ball', 806: 'sock', 807: 'solar thermal collector', 808: 'sombrero', 809: 'soup bowl', 810: 'space bar', 811: 'space heater', 812: 'space shuttle', 813: 'spatula', 814: 'motorboat', 815: 'spider web', 816: 'spindle', 817: 'sports car', 818: 'spotlight', 819: 'stage', 820: 'steam locomotive', 821: 'through arch bridge', 822: 'steel drum', 823: 'stethoscope', 824: 'scarf', 825: 'stone wall', 826: 'stopwatch', 827: 'stove', 828: 'strainer', 829: 'tram', 830: 'stretcher', 831: 'couch', 832: 'stupa', 833: 'submarine', 834: 'suit', 835: 'sundial', 836: 'sunglass', 837: 'sunglasses', 838: 'sunscreen', 839: 'suspension bridge', 840: 'mop', 841: 'sweatshirt', 842: 'swimsuit', 843: 'swing', 844: 'switch', 845: 'syringe', 846: 'table lamp', 847: 'tank', 848: 'tape player', 849: 'teapot', 850: 'teddy bear', 851: 'television', 852: 'tennis ball', 853: 'thatched roof', 854: 'front curtain', 855: 'thimble', 856: 'threshing machine', 857: 'throne', 858: 'tile roof', 859: 'toaster', 860: 'tobacco shop', 861: 'toilet seat', 862: 'torch', 863: 'totem pole', 864: 'tow truck', 865: 'toy store', 866: 'tractor', 867: 'semi-trailer truck', 868: 'tray', 869: 'trench coat', 870: 'tricycle', 871: 'trimaran', 872: 'tripod', 873: 'triumphal arch', 874: 'trolleybus', 875: 'trombone', 876: 'tub', 877: 'turnstile', 878: 'typewriter keyboard', 879: 'umbrella', 880: 'unicycle', 881: 'upright piano', 882: 'vacuum cleaner', 883: 'vase', 884: 'vault', 885: 'velvet', 886: 'vending machine', 887: 'vestment', 888: 'viaduct', 889: 'violin', 890: 'volleyball', 891: 'waffle iron', 892: 'wall clock', 893: 'wallet', 894: 'wardrobe', 895: 'military aircraft', 896: 'sink', 897: 'washing machine', 898: 'water bottle', 899: 'water jug', 900: 'water tower', 901: 'whiskey jug', 902: 'whistle', 903: 'wig', 904: 'window screen', 905: 'window shade', 906: 'Windsor tie', 907: 'wine bottle', 908: 'wing', 909: 'wok', 910: 'wooden spoon', 911: 'wool', 912: 'split-rail fence', 913: 'shipwreck', 914: 'yawl', 915: 'yurt', 916: 'website', 917: 'comic book', 918: 'crossword', 919: 'traffic sign', 920: 'traffic light', 921: 'dust jacket', 922: 'menu', 923: 'plate', 924: 'guacamole', 925: 'consomme', 926: 'hot pot', 927: 'trifle', 928: 'ice cream', 929: 'ice pop', 930: 'baguette', 931: 'bagel', 932: 'pretzel', 933: 'cheeseburger', 934: 'hot dog', 935: 'mashed potato', 936: 'cabbage', 937: 'broccoli', 938: 'cauliflower', 939: 'zucchini', 940: 'spaghetti squash', 941: 'acorn squash', 942: 'butternut squash', 943: 'cucumber', 944: 'artichoke', 945: 'bell pepper', 946: 'cardoon', 947: 'mushroom', 948: 'Granny Smith', 949: 'strawberry', 950: 'orange', 951: 'lemon', 952: 'fig', 953: 'pineapple', 954: 'banana', 955: 'jackfruit', 956: 'custard apple', 957: 'pomegranate', 958: 'hay', 959: 'carbonara', 960: 'chocolate syrup', 961: 'dough', 962: 'meatloaf', 963: 'pizza', 964: 'pot pie', 965: 'burrito', 966: 'red wine', 967: 'espresso', 968: 'cup', 969: 'eggnog', 970: 'alp', 971: 'bubble', 972: 'cliff', 973: 'coral reef', 974: 'geyser', 975: 'lakeshore', 976: 'promontory', 977: 'shoal', 978: 'seashore', 979: 'valley', 980: 'volcano', 981: 'baseball player', 982: 'bridegroom', 983: 'scuba diver', 984: 'rapeseed', 985: 'daisy', 986: "yellow lady's slipper", 987: 'corn', 988: 'acorn', 989: 'rose hip', 990: 'horse chestnut seed', 991: 'coral fungus', 992: 'agaric', 993: 'gyromitra', 994: 'stinkhorn mushroom', 995: 'earth star', 996: 'hen-of-the-woods', 997: 'bolete', 998: 'ear', 999: 'toilet paper'} top5i: [654, 734, 408, 757, 874] image 1/1 /home/yolov5/data/images/bus.jpg: 224x224 minibus 0.39, police van 0.24, amphibious vehicle 0.05, recreational vehicle 0.04, trolleybus 0.03, 2.7ms Speed: 0.2ms pre-process, 2.7ms inference, 0.0ms NMS per image at shape (1, 3, 224, 224) Results saved to runs/predict-cls/exp11 2.python export.py --weights yolov5s-cls.pt --include engine onnx --imgsz 224 --device 0 export: data=data/coco128.yaml, weights=['yolov5s-cls.pt'], imgsz=[224], batch_size=1, device=0, half=False, inplace=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=17, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['engine', 'onnx'] YOLOv5 🚀 v7.0-185-g2334aa7 Python-3.8.17 torch-1.13.1+cu117 CUDA:0 (NVIDIA GeForce RTX 3090, 24252MiB)

Fusing layers... Model summary: 117 layers, 5447688 parameters, 0 gradients, 11.4 GFLOPs

PyTorch: starting from yolov5s-cls.pt with output shape (1, 1000) (10.5 MB)

ONNX: starting export with onnx 1.14.0... ONNX: export success ✅ 0.2s, saved as yolov5s-cls.onnx (20.8 MB)

TensorRT: starting export with TensorRT 8.4.3.1... [09/18/2023-16:46:38] [TRT] [I] [MemUsageChange] Init CUDA: CPU +320, GPU +0, now: CPU 3676, GPU 2472 (MiB) [09/18/2023-16:46:39] [TRT] [I] [MemUsageChange] Init builder kernel library: CPU +328, GPU +104, now: CPU 4023, GPU 2576 (MiB) export.py:344: DeprecationWarning: Use set_memory_pool_limit instead. config.max_workspace_size = workspace * 1 << 30 [09/18/2023-16:46:39] [TRT] [I] ---------------------------------------------------------------- [09/18/2023-16:46:39] [TRT] [I] Input filename: yolov5s-cls.onnx [09/18/2023-16:46:39] [TRT] [I] ONNX IR version: 0.0.7 [09/18/2023-16:46:39] [TRT] [I] Opset version: 12 [09/18/2023-16:46:39] [TRT] [I] Producer name: pytorch [09/18/2023-16:46:39] [TRT] [I] Producer version: 1.13.1 [09/18/2023-16:46:39] [TRT] [I] Domain:
[09/18/2023-16:46:39] [TRT] [I] Model version: 0 [09/18/2023-16:46:39] [TRT] [I] Doc string:
[09/18/2023-16:46:39] [TRT] [I] ---------------------------------------------------------------- TensorRT: input "images" with shape(1, 3, 224, 224) DataType.FLOAT TensorRT: output "output0" with shape(1, 1000) DataType.FLOAT TensorRT: building FP32 engine as yolov5s-cls.engine export.py:371: DeprecationWarning: Use build_serialized_network instead. with builder.build_engine(network, config) as engine, open(f, 'wb') as t: [09/18/2023-16:46:39] [TRT] [I] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +0, GPU +32, now: CPU 4045, GPU 2608 (MiB) [09/18/2023-16:46:39] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +1, GPU +32, now: CPU 4046, GPU 2640 (MiB) [09/18/2023-16:46:39] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.4.0 [09/18/2023-16:46:39] [TRT] [I] Local timing cache in use. Profiling results in this builder pass will not be stored. [09/18/2023-16:47:25] [TRT] [I] Detected 1 inputs and 1 output network tensors. [09/18/2023-16:47:25] [TRT] [I] Total Host Persistent Memory: 71248 [09/18/2023-16:47:25] [TRT] [I] Total Device Persistent Memory: 0 [09/18/2023-16:47:25] [TRT] [I] Total Scratch Memory: 9476608 [09/18/2023-16:47:25] [TRT] [I] [MemUsageStats] Peak memory usage of TRT CPU/GPU memory allocators: CPU 0 MiB, GPU 0 MiB [09/18/2023-16:47:25] [TRT] [I] [BlockAssignment] Algorithm ShiftNTopDown took 1.738ms to assign 6 blocks to 68 nodes requiring 12286468 bytes. [09/18/2023-16:47:25] [TRT] [I] Total Activation Memory: 12286468 [09/18/2023-16:47:25] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +34, now: CPU 4056, GPU 2683 (MiB) [09/18/2023-16:47:25] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.4.0 [09/18/2023-16:47:25] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in building engine: CPU +0, GPU +0, now: CPU 0, GPU 0 (MiB) [09/18/2023-16:47:25] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1. [09/18/2023-16:47:25] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1. TensorRT: export success ✅ 46.9s, saved as yolov5s-cls.engine (21.6 MB)

ONNX: starting export with onnx 1.14.0... ONNX: export success ✅ 0.2s, saved as yolov5s-cls.onnx (20.8 MB)

Export complete (49.3s) Results saved to /home/yolov5 Detect: python classify/predict.py --weights yolov5s-cls.onnx Validate: python classify/val.py --weights yolov5s-cls.onnx PyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'custom', 'yolov5s-cls.onnx') # WARNING ⚠️ ClassificationModel not yet supported for PyTorch Hub AutoShape inference Visualize: https://netron.app 3.python classify/predict.py --weights yolov5s-cls.onnx --source ./data/images/bus.jpg classify/predict: weights=['yolov5s-cls.onnx'], source=./data/images/bus.jpg, data=data/coco128.yaml, imgsz=[224, 224], device=, view_img=False, save_txt=False, nosave=False, augment=False, visualize=False, update=False, project=runs/predict-cls, name=exp, exist_ok=False, half=False, dnn=False, vid_stride=1 YOLOv5 🚀 v7.0-185-g2334aa7 Python-3.8.17 torch-1.13.1+cu117 CUDA:0 (NVIDIA GeForce RTX 3090, 24252MiB)

Loading yolov5s-cls.onnx for ONNX Runtime inference... names: {0: 'tench', 1: 'goldfish', 2: 'great white shark', 3: 'tiger shark', 4: 'hammerhead shark', 5: 'electric ray', 6: 'stingray', 7: 'cock', 8: 'hen', 9: 'ostrich', 10: 'brambling', 11: 'goldfinch', 12: 'house finch', 13: 'junco', 14: 'indigo bunting', 15: 'American robin', 16: 'bulbul', 17: 'jay', 18: 'magpie', 19: 'chickadee', 20: 'American dipper', 21: 'kite', 22: 'bald eagle', 23: 'vulture', 24: 'great grey owl', 25: 'fire salamander', 26: 'smooth newt', 27: 'newt', 28: 'spotted salamander', 29: 'axolotl', 30: 'American bullfrog', 31: 'tree frog', 32: 'tailed frog', 33: 'loggerhead sea turtle', 34: 'leatherback sea turtle', 35: 'mud turtle', 36: 'terrapin', 37: 'box turtle', 38: 'banded gecko', 39: 'green iguana', 40: 'Carolina anole', 41: 'desert grassland whiptail lizard', 42: 'agama', 43: 'frilled-necked lizard', 44: 'alligator lizard', 45: 'Gila monster', 46: 'European green lizard', 47: 'chameleon', 48: 'Komodo dragon', 49: 'Nile crocodile', 50: 'American alligator', 51: 'triceratops', 52: 'worm snake', 53: 'ring-necked snake', 54: 'eastern hog-nosed snake', 55: 'smooth green snake', 56: 'kingsnake', 57: 'garter snake', 58: 'water snake', 59: 'vine snake', 60: 'night snake', 61: 'boa constrictor', 62: 'African rock python', 63: 'Indian cobra', 64: 'green mamba', 65: 'sea snake', 66: 'Saharan horned viper', 67: 'eastern diamondback rattlesnake', 68: 'sidewinder', 69: 'trilobite', 70: 'harvestman', 71: 'scorpion', 72: 'yellow garden spider', 73: 'barn spider', 74: 'European garden spider', 75: 'southern black widow', 76: 'tarantula', 77: 'wolf spider', 78: 'tick', 79: 'centipede', 80: 'black grouse', 81: 'ptarmigan', 82: 'ruffed grouse', 83: 'prairie grouse', 84: 'peacock', 85: 'quail', 86: 'partridge', 87: 'grey parrot', 88: 'macaw', 89: 'sulphur-crested cockatoo', 90: 'lorikeet', 91: 'coucal', 92: 'bee eater', 93: 'hornbill', 94: 'hummingbird', 95: 'jacamar', 96: 'toucan', 97: 'duck', 98: 'red-breasted merganser', 99: 'goose', 100: 'black swan', 101: 'tusker', 102: 'echidna', 103: 'platypus', 104: 'wallaby', 105: 'koala', 106: 'wombat', 107: 'jellyfish', 108: 'sea anemone', 109: 'brain coral', 110: 'flatworm', 111: 'nematode', 112: 'conch', 113: 'snail', 114: 'slug', 115: 'sea slug', 116: 'chiton', 117: 'chambered nautilus', 118: 'Dungeness crab', 119: 'rock crab', 120: 'fiddler crab', 121: 'red king crab', 122: 'American lobster', 123: 'spiny lobster', 124: 'crayfish', 125: 'hermit crab', 126: 'isopod', 127: 'white stork', 128: 'black stork', 129: 'spoonbill', 130: 'flamingo', 131: 'little blue heron', 132: 'great egret', 133: 'bittern', 134: 'crane (bird)', 135: 'limpkin', 136: 'common gallinule', 137: 'American coot', 138: 'bustard', 139: 'ruddy turnstone', 140: 'dunlin', 141: 'common redshank', 142: 'dowitcher', 143: 'oystercatcher', 144: 'pelican', 145: 'king penguin', 146: 'albatross', 147: 'grey whale', 148: 'killer whale', 149: 'dugong', 150: 'sea lion', 151: 'Chihuahua', 152: 'Japanese Chin', 153: 'Maltese', 154: 'Pekingese', 155: 'Shih Tzu', 156: 'King Charles Spaniel', 157: 'Papillon', 158: 'toy terrier', 159: 'Rhodesian Ridgeback', 160: 'Afghan Hound', 161: 'Basset Hound', 162: 'Beagle', 163: 'Bloodhound', 164: 'Bluetick Coonhound', 165: 'Black and Tan Coonhound', 166: 'Treeing Walker Coonhound', 167: 'English foxhound', 168: 'Redbone Coonhound', 169: 'borzoi', 170: 'Irish Wolfhound', 171: 'Italian Greyhound', 172: 'Whippet', 173: 'Ibizan Hound', 174: 'Norwegian Elkhound', 175: 'Otterhound', 176: 'Saluki', 177: 'Scottish Deerhound', 178: 'Weimaraner', 179: 'Staffordshire Bull Terrier', 180: 'American Staffordshire Terrier', 181: 'Bedlington Terrier', 182: 'Border Terrier', 183: 'Kerry Blue Terrier', 184: 'Irish Terrier', 185: 'Norfolk Terrier', 186: 'Norwich Terrier', 187: 'Yorkshire Terrier', 188: 'Wire Fox Terrier', 189: 'Lakeland Terrier', 190: 'Sealyham Terrier', 191: 'Airedale Terrier', 192: 'Cairn Terrier', 193: 'Australian Terrier', 194: 'Dandie Dinmont Terrier', 195: 'Boston Terrier', 196: 'Miniature Schnauzer', 197: 'Giant Schnauzer', 198: 'Standard Schnauzer', 199: 'Scottish Terrier', 200: 'Tibetan Terrier', 201: 'Australian Silky Terrier', 202: 'Soft-coated Wheaten Terrier', 203: 'West Highland White Terrier', 204: 'Lhasa Apso', 205: 'Flat-Coated Retriever', 206: 'Curly-coated Retriever', 207: 'Golden Retriever', 208: 'Labrador Retriever', 209: 'Chesapeake Bay Retriever', 210: 'German Shorthaired Pointer', 211: 'Vizsla', 212: 'English Setter', 213: 'Irish Setter', 214: 'Gordon Setter', 215: 'Brittany', 216: 'Clumber Spaniel', 217: 'English Springer Spaniel', 218: 'Welsh Springer Spaniel', 219: 'Cocker Spaniels', 220: 'Sussex Spaniel', 221: 'Irish Water Spaniel', 222: 'Kuvasz', 223: 'Schipperke', 224: 'Groenendael', 225: 'Malinois', 226: 'Briard', 227: 'Australian Kelpie', 228: 'Komondor', 229: 'Old English Sheepdog', 230: 'Shetland Sheepdog', 231: 'collie', 232: 'Border Collie', 233: 'Bouvier des Flandres', 234: 'Rottweiler', 235: 'German Shepherd Dog', 236: 'Dobermann', 237: 'Miniature Pinscher', 238: 'Greater Swiss Mountain Dog', 239: 'Bernese Mountain Dog', 240: 'Appenzeller Sennenhund', 241: 'Entlebucher Sennenhund', 242: 'Boxer', 243: 'Bullmastiff', 244: 'Tibetan Mastiff', 245: 'French Bulldog', 246: 'Great Dane', 247: 'St. Bernard', 248: 'husky', 249: 'Alaskan Malamute', 250: 'Siberian Husky', 251: 'Dalmatian', 252: 'Affenpinscher', 253: 'Basenji', 254: 'pug', 255: 'Leonberger', 256: 'Newfoundland', 257: 'Pyrenean Mountain Dog', 258: 'Samoyed', 259: 'Pomeranian', 260: 'Chow Chow', 261: 'Keeshond', 262: 'Griffon Bruxellois', 263: 'Pembroke Welsh Corgi', 264: 'Cardigan Welsh Corgi', 265: 'Toy Poodle', 266: 'Miniature Poodle', 267: 'Standard Poodle', 268: 'Mexican hairless dog', 269: 'grey wolf', 270: 'Alaskan tundra wolf', 271: 'red wolf', 272: 'coyote', 273: 'dingo', 274: 'dhole', 275: 'African wild dog', 276: 'hyena', 277: 'red fox', 278: 'kit fox', 279: 'Arctic fox', 280: 'grey fox', 281: 'tabby cat', 282: 'tiger cat', 283: 'Persian cat', 284: 'Siamese cat', 285: 'Egyptian Mau', 286: 'cougar', 287: 'lynx', 288: 'leopard', 289: 'snow leopard', 290: 'jaguar', 291: 'lion', 292: 'tiger', 293: 'cheetah', 294: 'brown bear', 295: 'American black bear', 296: 'polar bear', 297: 'sloth bear', 298: 'mongoose', 299: 'meerkat', 300: 'tiger beetle', 301: 'ladybug', 302: 'ground beetle', 303: 'longhorn beetle', 304: 'leaf beetle', 305: 'dung beetle', 306: 'rhinoceros beetle', 307: 'weevil', 308: 'fly', 309: 'bee', 310: 'ant', 311: 'grasshopper', 312: 'cricket', 313: 'stick insect', 314: 'cockroach', 315: 'mantis', 316: 'cicada', 317: 'leafhopper', 318: 'lacewing', 319: 'dragonfly', 320: 'damselfly', 321: 'red admiral', 322: 'ringlet', 323: 'monarch butterfly', 324: 'small white', 325: 'sulphur butterfly', 326: 'gossamer-winged butterfly', 327: 'starfish', 328: 'sea urchin', 329: 'sea cucumber', 330: 'cottontail rabbit', 331: 'hare', 332: 'Angora rabbit', 333: 'hamster', 334: 'porcupine', 335: 'fox squirrel', 336: 'marmot', 337: 'beaver', 338: 'guinea pig', 339: 'common sorrel', 340: 'zebra', 341: 'pig', 342: 'wild boar', 343: 'warthog', 344: 'hippopotamus', 345: 'ox', 346: 'water buffalo', 347: 'bison', 348: 'ram', 349: 'bighorn sheep', 350: 'Alpine ibex', 351: 'hartebeest', 352: 'impala', 353: 'gazelle', 354: 'dromedary', 355: 'llama', 356: 'weasel', 357: 'mink', 358: 'European polecat', 359: 'black-footed ferret', 360: 'otter', 361: 'skunk', 362: 'badger', 363: 'armadillo', 364: 'three-toed sloth', 365: 'orangutan', 366: 'gorilla', 367: 'chimpanzee', 368: 'gibbon', 369: 'siamang', 370: 'guenon', 371: 'patas monkey', 372: 'baboon', 373: 'macaque', 374: 'langur', 375: 'black-and-white colobus', 376: 'proboscis monkey', 377: 'marmoset', 378: 'white-headed capuchin', 379: 'howler monkey', 380: 'titi', 381: "Geoffroy's spider monkey", 382: 'common squirrel monkey', 383: 'ring-tailed lemur', 384: 'indri', 385: 'Asian elephant', 386: 'African bush elephant', 387: 'red panda', 388: 'giant panda', 389: 'snoek', 390: 'eel', 391: 'coho salmon', 392: 'rock beauty', 393: 'clownfish', 394: 'sturgeon', 395: 'garfish', 396: 'lionfish', 397: 'pufferfish', 398: 'abacus', 399: 'abaya', 400: 'academic gown', 401: 'accordion', 402: 'acoustic guitar', 403: 'aircraft carrier', 404: 'airliner', 405: 'airship', 406: 'altar', 407: 'ambulance', 408: 'amphibious vehicle', 409: 'analog clock', 410: 'apiary', 411: 'apron', 412: 'waste container', 413: 'assault rifle', 414: 'backpack', 415: 'bakery', 416: 'balance beam', 417: 'balloon', 418: 'ballpoint pen', 419: 'Band-Aid', 420: 'banjo', 421: 'baluster', 422: 'barbell', 423: 'barber chair', 424: 'barbershop', 425: 'barn', 426: 'barometer', 427: 'barrel', 428: 'wheelbarrow', 429: 'baseball', 430: 'basketball', 431: 'bassinet', 432: 'bassoon', 433: 'swimming cap', 434: 'bath towel', 435: 'bathtub', 436: 'station wagon', 437: 'lighthouse', 438: 'beaker', 439: 'military cap', 440: 'beer bottle', 441: 'beer glass', 442: 'bell-cot', 443: 'bib', 444: 'tandem bicycle', 445: 'bikini', 446: 'ring binder', 447: 'binoculars', 448: 'birdhouse', 449: 'boathouse', 450: 'bobsleigh', 451: 'bolo tie', 452: 'poke bonnet', 453: 'bookcase', 454: 'bookstore', 455: 'bottle cap', 456: 'bow', 457: 'bow tie', 458: 'brass', 459: 'bra', 460: 'breakwater', 461: 'breastplate', 462: 'broom', 463: 'bucket', 464: 'buckle', 465: 'bulletproof vest', 466: 'high-speed train', 467: 'butcher shop', 468: 'taxicab', 469: 'cauldron', 470: 'candle', 471: 'cannon', 472: 'canoe', 473: 'can opener', 474: 'cardigan', 475: 'car mirror', 476: 'carousel', 477: 'tool kit', 478: 'carton', 479: 'car wheel', 480: 'automated teller machine', 481: 'cassette', 482: 'cassette player', 483: 'castle', 484: 'catamaran', 485: 'CD player', 486: 'cello', 487: 'mobile phone', 488: 'chain', 489: 'chain-link fence', 490: 'chain mail', 491: 'chainsaw', 492: 'chest', 493: 'chiffonier', 494: 'chime', 495: 'china cabinet', 496: 'Christmas stocking', 497: 'church', 498: 'movie theater', 499: 'cleaver', 500: 'cliff dwelling', 501: 'cloak', 502: 'clogs', 503: 'cocktail shaker', 504: 'coffee mug', 505: 'coffeemaker', 506: 'coil', 507: 'combination lock', 508: 'computer keyboard', 509: 'confectionery store', 510: 'container ship', 511: 'convertible', 512: 'corkscrew', 513: 'cornet', 514: 'cowboy boot', 515: 'cowboy hat', 516: 'cradle', 517: 'crane (machine)', 518: 'crash helmet', 519: 'crate', 520: 'infant bed', 521: 'Crock Pot', 522: 'croquet ball', 523: 'crutch', 524: 'cuirass', 525: 'dam', 526: 'desk', 527: 'desktop computer', 528: 'rotary dial telephone', 529: 'diaper', 530: 'digital clock', 531: 'digital watch', 532: 'dining table', 533: 'dishcloth', 534: 'dishwasher', 535: 'disc brake', 536: 'dock', 537: 'dog sled', 538: 'dome', 539: 'doormat', 540: 'drilling rig', 541: 'drum', 542: 'drumstick', 543: 'dumbbell', 544: 'Dutch oven', 545: 'electric fan', 546: 'electric guitar', 547: 'electric locomotive', 548: 'entertainment center', 549: 'envelope', 550: 'espresso machine', 551: 'face powder', 552: 'feather boa', 553: 'filing cabinet', 554: 'fireboat', 555: 'fire engine', 556: 'fire screen sheet', 557: 'flagpole', 558: 'flute', 559: 'folding chair', 560: 'football helmet', 561: 'forklift', 562: 'fountain', 563: 'fountain pen', 564: 'four-poster bed', 565: 'freight car', 566: 'French horn', 567: 'frying pan', 568: 'fur coat', 569: 'garbage truck', 570: 'gas mask', 571: 'gas pump', 572: 'goblet', 573: 'go-kart', 574: 'golf ball', 575: 'golf cart', 576: 'gondola', 577: 'gong', 578: 'gown', 579: 'grand piano', 580: 'greenhouse', 581: 'grille', 582: 'grocery store', 583: 'guillotine', 584: 'barrette', 585: 'hair spray', 586: 'half-track', 587: 'hammer', 588: 'hamper', 589: 'hair dryer', 590: 'hand-held computer', 591: 'handkerchief', 592: 'hard disk drive', 593: 'harmonica', 594: 'harp', 595: 'harvester', 596: 'hatchet', 597: 'holster', 598: 'home theater', 599: 'honeycomb', 600: 'hook', 601: 'hoop skirt', 602: 'horizontal bar', 603: 'horse-drawn vehicle', 604: 'hourglass', 605: 'iPod', 606: 'clothes iron', 607: "jack-o'-lantern", 608: 'jeans', 609: 'jeep', 610: 'T-shirt', 611: 'jigsaw puzzle', 612: 'pulled rickshaw', 613: 'joystick', 614: 'kimono', 615: 'knee pad', 616: 'knot', 617: 'lab coat', 618: 'ladle', 619: 'lampshade', 620: 'laptop computer', 621: 'lawn mower', 622: 'lens cap', 623: 'paper knife', 624: 'library', 625: 'lifeboat', 626: 'lighter', 627: 'limousine', 628: 'ocean liner', 629: 'lipstick', 630: 'slip-on shoe', 631: 'lotion', 632: 'speaker', 633: 'loupe', 634: 'sawmill', 635: 'magnetic compass', 636: 'mail bag', 637: 'mailbox', 638: 'tights', 639: 'tank suit', 640: 'manhole cover', 641: 'maraca', 642: 'marimba', 643: 'mask', 644: 'match', 645: 'maypole', 646: 'maze', 647: 'measuring cup', 648: 'medicine chest', 649: 'megalith', 650: 'microphone', 651: 'microwave oven', 652: 'military uniform', 653: 'milk can', 654: 'minibus', 655: 'miniskirt', 656: 'minivan', 657: 'missile', 658: 'mitten', 659: 'mixing bowl', 660: 'mobile home', 661: 'Model T', 662: 'modem', 663: 'monastery', 664: 'monitor', 665: 'moped', 666: 'mortar', 667: 'square academic cap', 668: 'mosque', 669: 'mosquito net', 670: 'scooter', 671: 'mountain bike', 672: 'tent', 673: 'computer mouse', 674: 'mousetrap', 675: 'moving van', 676: 'muzzle', 677: 'nail', 678: 'neck brace', 679: 'necklace', 680: 'nipple', 681: 'notebook computer', 682: 'obelisk', 683: 'oboe', 684: 'ocarina', 685: 'odometer', 686: 'oil filter', 687: 'organ', 688: 'oscilloscope', 689: 'overskirt', 690: 'bullock cart', 691: 'oxygen mask', 692: 'packet', 693: 'paddle', 694: 'paddle wheel', 695: 'padlock', 696: 'paintbrush', 697: 'pajamas', 698: 'palace', 699: 'pan flute', 700: 'paper towel', 701: 'parachute', 702: 'parallel bars', 703: 'park bench', 704: 'parking meter', 705: 'passenger car', 706: 'patio', 707: 'payphone', 708: 'pedestal', 709: 'pencil case', 710: 'pencil sharpener', 711: 'perfume', 712: 'Petri dish', 713: 'photocopier', 714: 'plectrum', 715: 'Pickelhaube', 716: 'picket fence', 717: 'pickup truck', 718: 'pier', 719: 'piggy bank', 720: 'pill bottle', 721: 'pillow', 722: 'ping-pong ball', 723: 'pinwheel', 724: 'pirate ship', 725: 'pitcher', 726: 'hand plane', 727: 'planetarium', 728: 'plastic bag', 729: 'plate rack', 730: 'plow', 731: 'plunger', 732: 'Polaroid camera', 733: 'pole', 734: 'police van', 735: 'poncho', 736: 'billiard table', 737: 'soda bottle', 738: 'pot', 739: "potter's wheel", 740: 'power drill', 741: 'prayer rug', 742: 'printer', 743: 'prison', 744: 'projectile', 745: 'projector', 746: 'hockey puck', 747: 'punching bag', 748: 'purse', 749: 'quill', 750: 'quilt', 751: 'race car', 752: 'racket', 753: 'radiator', 754: 'radio', 755: 'radio telescope', 756: 'rain barrel', 757: 'recreational vehicle', 758: 'reel', 759: 'reflex camera', 760: 'refrigerator', 761: 'remote control', 762: 'restaurant', 763: 'revolver', 764: 'rifle', 765: 'rocking chair', 766: 'rotisserie', 767: 'eraser', 768: 'rugby ball', 769: 'ruler', 770: 'running shoe', 771: 'safe', 772: 'safety pin', 773: 'salt shaker', 774: 'sandal', 775: 'sarong', 776: 'saxophone', 777: 'scabbard', 778: 'weighing scale', 779: 'school bus', 780: 'schooner', 781: 'scoreboard', 782: 'CRT screen', 783: 'screw', 784: 'screwdriver', 785: 'seat belt', 786: 'sewing machine', 787: 'shield', 788: 'shoe store', 789: 'shoji', 790: 'shopping basket', 791: 'shopping cart', 792: 'shovel', 793: 'shower cap', 794: 'shower curtain', 795: 'ski', 796: 'ski mask', 797: 'sleeping bag', 798: 'slide rule', 799: 'sliding door', 800: 'slot machine', 801: 'snorkel', 802: 'snowmobile', 803: 'snowplow', 804: 'soap dispenser', 805: 'soccer ball', 806: 'sock', 807: 'solar thermal collector', 808: 'sombrero', 809: 'soup bowl', 810: 'space bar', 811: 'space heater', 812: 'space shuttle', 813: 'spatula', 814: 'motorboat', 815: 'spider web', 816: 'spindle', 817: 'sports car', 818: 'spotlight', 819: 'stage', 820: 'steam locomotive', 821: 'through arch bridge', 822: 'steel drum', 823: 'stethoscope', 824: 'scarf', 825: 'stone wall', 826: 'stopwatch', 827: 'stove', 828: 'strainer', 829: 'tram', 830: 'stretcher', 831: 'couch', 832: 'stupa', 833: 'submarine', 834: 'suit', 835: 'sundial', 836: 'sunglass', 837: 'sunglasses', 838: 'sunscreen', 839: 'suspension bridge', 840: 'mop', 841: 'sweatshirt', 842: 'swimsuit', 843: 'swing', 844: 'switch', 845: 'syringe', 846: 'table lamp', 847: 'tank', 848: 'tape player', 849: 'teapot', 850: 'teddy bear', 851: 'television', 852: 'tennis ball', 853: 'thatched roof', 854: 'front curtain', 855: 'thimble', 856: 'threshing machine', 857: 'throne', 858: 'tile roof', 859: 'toaster', 860: 'tobacco shop', 861: 'toilet seat', 862: 'torch', 863: 'totem pole', 864: 'tow truck', 865: 'toy store', 866: 'tractor', 867: 'semi-trailer truck', 868: 'tray', 869: 'trench coat', 870: 'tricycle', 871: 'trimaran', 872: 'tripod', 873: 'triumphal arch', 874: 'trolleybus', 875: 'trombone', 876: 'tub', 877: 'turnstile', 878: 'typewriter keyboard', 879: 'umbrella', 880: 'unicycle', 881: 'upright piano', 882: 'vacuum cleaner', 883: 'vase', 884: 'vault', 885: 'velvet', 886: 'vending machine', 887: 'vestment', 888: 'viaduct', 889: 'violin', 890: 'volleyball', 891: 'waffle iron', 892: 'wall clock', 893: 'wallet', 894: 'wardrobe', 895: 'military aircraft', 896: 'sink', 897: 'washing machine', 898: 'water bottle', 899: 'water jug', 900: 'water tower', 901: 'whiskey jug', 902: 'whistle', 903: 'wig', 904: 'window screen', 905: 'window shade', 906: 'Windsor tie', 907: 'wine bottle', 908: 'wing', 909: 'wok', 910: 'wooden spoon', 911: 'wool', 912: 'split-rail fence', 913: 'shipwreck', 914: 'yawl', 915: 'yurt', 916: 'website', 917: 'comic book', 918: 'crossword', 919: 'traffic sign', 920: 'traffic light', 921: 'dust jacket', 922: 'menu', 923: 'plate', 924: 'guacamole', 925: 'consomme', 926: 'hot pot', 927: 'trifle', 928: 'ice cream', 929: 'ice pop', 930: 'baguette', 931: 'bagel', 932: 'pretzel', 933: 'cheeseburger', 934: 'hot dog', 935: 'mashed potato', 936: 'cabbage', 937: 'broccoli', 938: 'cauliflower', 939: 'zucchini', 940: 'spaghetti squash', 941: 'acorn squash', 942: 'butternut squash', 943: 'cucumber', 944: 'artichoke', 945: 'bell pepper', 946: 'cardoon', 947: 'mushroom', 948: 'Granny Smith', 949: 'strawberry', 950: 'orange', 951: 'lemon', 952: 'fig', 953: 'pineapple', 954: 'banana', 955: 'jackfruit', 956: 'custard apple', 957: 'pomegranate', 958: 'hay', 959: 'carbonara', 960: 'chocolate syrup', 961: 'dough', 962: 'meatloaf', 963: 'pizza', 964: 'pot pie', 965: 'burrito', 966: 'red wine', 967: 'espresso', 968: 'cup', 969: 'eggnog', 970: 'alp', 971: 'bubble', 972: 'cliff', 973: 'coral reef', 974: 'geyser', 975: 'lakeshore', 976: 'promontory', 977: 'shoal', 978: 'seashore', 979: 'valley', 980: 'volcano', 981: 'baseball player', 982: 'bridegroom', 983: 'scuba diver', 984: 'rapeseed', 985: 'daisy', 986: "yellow lady's slipper", 987: 'corn', 988: 'acorn', 989: 'rose hip', 990: 'horse chestnut seed', 991: 'coral fungus', 992: 'agaric', 993: 'gyromitra', 994: 'stinkhorn mushroom', 995: 'earth star', 996: 'hen-of-the-woods', 997: 'bolete', 998: 'ear', 999: 'toilet paper'} top5i: [654, 734, 408, 757, 874] image 1/1 /home/yolov5/data/images/bus.jpg: 224x224 minibus 0.39, police van 0.24, amphibious vehicle 0.05, recreational vehicle 0.04, trolleybus 0.03, 2.4ms Speed: 1.2ms pre-process, 2.4ms inference, 0.1ms NMS per image at shape (1, 3, 224, 224) Results saved to runs/predict-cls/exp12`

4.`python classify/predict.py --weights yolov5s-cls.engine --source ./data/images/bus.jpg classify/predict: weights=['yolov5s-cls.engine'], source=./data/images/bus.jpg, data=data/coco128.yaml, imgsz=[224, 224], device=, view_img=False, save_txt=False, nosave=False, augment=False, visualize=False, update=False, project=runs/predict-cls, name=exp, exist_ok=False, half=False, dnn=False, vid_stride=1 YOLOv5 🚀 v7.0-185-g2334aa7 Python-3.8.17 torch-1.13.1+cu117 CUDA:0 (NVIDIA GeForce RTX 3090, 24252MiB)

Loading yolov5s-cls.engine for TensorRT inference... [09/18/2023-16:51:28] [TRT] [I] [MemUsageChange] Init CUDA: CPU +330, GPU +0, now: CPU 437, GPU 877 (MiB) [09/18/2023-16:51:28] [TRT] [I] Loaded engine size: 21 MiB [09/18/2023-16:51:28] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +1000, GPU +454, now: CPU 1484, GPU 1353 (MiB) [09/18/2023-16:51:28] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.4.0 [09/18/2023-16:51:28] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +0, now: CPU 0, GPU 0 (MiB) [09/18/2023-16:51:28] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +34, now: CPU 1463, GPU 1353 (MiB) [09/18/2023-16:51:28] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.4.0 [09/18/2023-16:51:28] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +0, now: CPU 0, GPU 0 (MiB) names: {0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus', 6: 'train', 7: 'truck', 8: 'boat', 9: 'traffic light', 10: 'fire hydrant', 11: 'stop sign', 12: 'parking meter', 13: 'bench', 14: 'bird', 15: 'cat', 16: 'dog', 17: 'horse', 18: 'sheep', 19: 'cow', 20: 'elephant', 21: 'bear', 22: 'zebra', 23: 'giraffe', 24: 'backpack', 25: 'umbrella', 26: 'handbag', 27: 'tie', 28: 'suitcase', 29: 'frisbee', 30: 'skis', 31: 'snowboard', 32: 'sports ball', 33: 'kite', 34: 'baseball bat', 35: 'baseball glove', 36: 'skateboard', 37: 'surfboard', 38: 'tennis racket', 39: 'bottle', 40: 'wine glass', 41: 'cup', 42: 'fork', 43: 'knife', 44: 'spoon', 45: 'bowl', 46: 'banana', 47: 'apple', 48: 'sandwich', 49: 'orange', 50: 'broccoli', 51: 'carrot', 52: 'hot dog', 53: 'pizza', 54: 'donut', 55: 'cake', 56: 'chair', 57: 'couch', 58: 'potted plant', 59: 'bed', 60: 'dining table', 61: 'toilet', 62: 'tv', 63: 'laptop', 64: 'mouse', 65: 'remote', 66: 'keyboard', 67: 'cell phone', 68: 'microwave', 69: 'oven', 70: 'toaster', 71: 'sink', 72: 'refrigerator', 73: 'book', 74: 'clock', 75: 'vase', 76: 'scissors', 77: 'teddy bear', 78: 'hair drier', 79: 'toothbrush'} top5i: [654, 734, 408, 757, 874] Traceback (most recent call last): File "classify/predict.py", line 234, in main(opt) File "classify/predict.py", line 227, in main run(*vars(opt)) File "/home/anaconda3/envs/openmmlab/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(args, **kwargs) File "classify/predict.py", line 148, in run s += f"{', '.join(f'{names[j]} {prob[j]:.2f}' for j in top5i)}, " File "classify/predict.py", line 148, in s += f"{', '.join(f'{names[j]} {prob[j]:.2f}' for j in top5i)}, " KeyError: 654 ` and we can see the pt file and onnx is ok.but the engine file is not.

github-actions[bot] commented 9 months ago

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐

glenn-jocher commented 8 months ago

Thank you for sharing the detailed steps, @jo-dean.

From your provided information, it seems that the issue lies in the conversion process to the engine format using export.py, as the generated model.names file for the engine format contains only 80 classes, whereas the original yolov5s-cls.pt file has 1k classes.

To address this issue, I will escalate this problem to the development team for further investigation. It's important for us to ensure that the engine format is correctly supporting the expected number of classes. We appreciate your diligence in providing the detailed steps and will work to provide you with a resolution as soon as possible.

Thank you for your patience and understanding as we work to resolve this issue. If you have any additional information or updates, feel free to share them with us.

Looking forward to getting this resolved for you soon.