File size: 59,464 Bytes
3752cdf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from PIL import Image\n",
"import pandas as pd\n",
"import os\n",
"from datasets import Dataset, Image, DatasetDict\n",
"from torchvision.transforms import RandomResizedCrop, Compose, Normalize, ToTensor\n",
"from transformers import (\n",
" AutoImageProcessor,\n",
" AutoModelForImageClassification,\n",
" TrainingArguments,\n",
" Trainer,\n",
" DefaultDataCollator,\n",
")\n",
"import evaluate\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load data"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"file2obj = pd.read_csv(\"../data/processed/OM_file_to_obj.csv\")\n",
"file2obj[\"image\"] = file2obj.apply(lambda x: os.path.join(\"..\", x[\"root\"], x[\"file\"]), axis=1)\n",
"file2obj.rename(columns={\"obj_num\": \"label\"}, inplace=True)\n",
"\n",
"# Group by 'obj_num' and count occurrences\n",
"obj_num_counts = file2obj[\"label\"].value_counts()\n",
"\n",
"# Filter rows where 'obj_num' appears more than twice\n",
"file2obj_3 = file2obj[file2obj[\"label\"].isin(obj_num_counts[obj_num_counts > 2].index)]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Form HF dataset"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "59370086a1b64dc5842d9becd9019aad",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Casting to class labels: 0%| | 0/25725 [00:00<?, ? examples/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"ds = Dataset.from_pandas(file2obj_3[[\"image\", \"label\"]], preserve_index=False).cast_column(\n",
" \"image\", Image()\n",
")\n",
"ds = ds.class_encode_column(\"label\")\n",
"trainval_test = ds.train_test_split(stratify_by_column=\"label\", test_size=0.16)\n",
"train_val = trainval_test[\"train\"].train_test_split(stratify_by_column=\"label\", test_size=16 / 84)\n",
"ds = DatasetDict(\n",
" {\"train\": train_val[\"train\"], \"valid\": train_val[\"test\"], \"test\": trainval_test[\"test\"]}\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Transform data"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"checkpoint = \"google/efficientnet-b3\"\n",
"image_processor = AutoImageProcessor.from_pretrained(checkpoint)\n",
"\n",
"\n",
"normalize = Normalize(mean=image_processor.image_mean, std=image_processor.image_std)\n",
"size = (\n",
" image_processor.size[\"shortest_edge\"]\n",
" if \"shortest_edge\" in image_processor.size\n",
" else (image_processor.size[\"height\"], image_processor.size[\"width\"])\n",
")\n",
"_transforms = Compose([RandomResizedCrop(size), ToTensor(), normalize])\n",
"\n",
"\n",
"def transforms(examples):\n",
" examples[\"pixel_values\"] = [_transforms(img.convert(\"RGB\")) for img in examples[\"image\"]]\n",
" del examples[\"image\"]\n",
" return examples\n",
"\n",
"\n",
"ds = ds.with_transform(transforms)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Set up model and metrics"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Some weights of EfficientNetForImageClassification were not initialized from the model checkpoint at google/efficientnet-b3 and are newly initialized because the shapes did not match:\n",
"- classifier.weight: found shape torch.Size([1000, 1536]) in the checkpoint and torch.Size([3872, 1536]) in the model instantiated\n",
"- classifier.bias: found shape torch.Size([1000]) in the checkpoint and torch.Size([3872]) in the model instantiated\n",
"You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
]
}
],
"source": [
"labels = ds[\"train\"].features[\"label\"].names\n",
"model = AutoModelForImageClassification.from_pretrained(\n",
" checkpoint,\n",
" num_labels=len(labels),\n",
" id2label={str(i): c for i, c in enumerate(labels)},\n",
" label2id={c: str(i) for i, c in enumerate(labels)},\n",
" ignore_mismatched_sizes=True,\n",
")\n",
"\n",
"data_collator = DefaultDataCollator()\n",
"\n",
"accuracy = evaluate.load(\"accuracy\")\n",
"\n",
"\n",
"def compute_metrics(eval_pred):\n",
" predictions, labels = eval_pred\n",
" predictions = np.argmax(predictions, axis=1)\n",
" return accuracy.compute(predictions=predictions, references=labels)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Train model"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[34m\u001b[1mwandb\u001b[0m: \u001b[33mWARNING\u001b[0m Serializing object of type dict that is 147552 bytes\n",
"\u001b[34m\u001b[1mwandb\u001b[0m: \u001b[33mWARNING\u001b[0m Serializing object of type dict that is 147552 bytes\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cb34337db5584dfbbc4a76bb7e724b26",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/274 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'loss': 8.0521, 'learning_rate': 1.785714285714286e-05, 'epoch': 0.04}\n",
"{'loss': 8.0927, 'learning_rate': 3.571428571428572e-05, 'epoch': 0.07}\n",
"{'loss': 8.1187, 'learning_rate': 4.959349593495935e-05, 'epoch': 0.11}\n",
"{'loss': 8.2335, 'learning_rate': 4.75609756097561e-05, 'epoch': 0.15}\n",
"{'loss': 8.2531, 'learning_rate': 4.5528455284552844e-05, 'epoch': 0.18}\n",
"{'loss': 8.2873, 'learning_rate': 4.3495934959349595e-05, 'epoch': 0.22}\n",
"{'loss': 8.2071, 'learning_rate': 4.146341463414634e-05, 'epoch': 0.26}\n",
"{'loss': 8.2287, 'learning_rate': 3.943089430894309e-05, 'epoch': 0.29}\n",
"{'loss': 8.1928, 'learning_rate': 3.739837398373984e-05, 'epoch': 0.33}\n",
"{'loss': 8.2053, 'learning_rate': 3.5365853658536584e-05, 'epoch': 0.36}\n",
"{'loss': 8.1621, 'learning_rate': 3.3333333333333335e-05, 'epoch': 0.4}\n",
"{'loss': 8.1731, 'learning_rate': 3.130081300813008e-05, 'epoch': 0.44}\n",
"{'loss': 8.1447, 'learning_rate': 2.926829268292683e-05, 'epoch': 0.47}\n",
"{'loss': 8.1161, 'learning_rate': 2.7235772357723577e-05, 'epoch': 0.51}\n",
"{'loss': 8.1081, 'learning_rate': 2.5203252032520324e-05, 'epoch': 0.55}\n",
"{'loss': 8.0828, 'learning_rate': 2.3170731707317075e-05, 'epoch': 0.58}\n",
"{'loss': 8.1312, 'learning_rate': 2.1138211382113822e-05, 'epoch': 0.62}\n",
"{'loss': 8.1627, 'learning_rate': 1.9105691056910573e-05, 'epoch': 0.66}\n",
"{'loss': 8.0692, 'learning_rate': 1.707317073170732e-05, 'epoch': 0.69}\n",
"{'loss': 7.9943, 'learning_rate': 1.5040650406504067e-05, 'epoch': 0.73}\n",
"{'loss': 8.0139, 'learning_rate': 1.3008130081300815e-05, 'epoch': 0.77}\n",
"{'loss': 8.027, 'learning_rate': 1.0975609756097562e-05, 'epoch': 0.8}\n",
"{'loss': 8.0628, 'learning_rate': 8.94308943089431e-06, 'epoch': 0.84}\n",
"{'loss': 8.1264, 'learning_rate': 6.910569105691057e-06, 'epoch': 0.88}\n",
"{'loss': 8.0408, 'learning_rate': 4.8780487804878055e-06, 'epoch': 0.91}\n",
"{'loss': 8.071, 'learning_rate': 2.8455284552845528e-06, 'epoch': 0.95}\n",
"{'loss': 8.1237, 'learning_rate': 8.130081300813009e-07, 'epoch': 0.99}\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5915cfa41d474a399ce0f53bc8f6f947",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/65 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'eval_loss': 8.02699089050293, 'eval_accuracy': 0.02575315840621963, 'eval_runtime': 25.2001, 'eval_samples_per_second': 163.333, 'eval_steps_per_second': 2.579, 'epoch': 1.0}\n",
"{'train_runtime': 236.2359, 'train_samples_per_second': 74.049, 'train_steps_per_second': 1.16, 'train_loss': 8.129460439194728, 'epoch': 1.0}\n"
]
},
{
"data": {
"text/plain": [
"TrainOutput(global_step=274, training_loss=8.129460439194728, metrics={'train_runtime': 236.2359, 'train_samples_per_second': 74.049, 'train_steps_per_second': 1.16, 'train_loss': 8.129460439194728, 'epoch': 1.0})"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"training_args = TrainingArguments(\n",
" output_dir=\"../models/test\",\n",
" remove_unused_columns=False,\n",
" evaluation_strategy=\"epoch\",\n",
" save_strategy=\"epoch\",\n",
" learning_rate=5e-5,\n",
" per_device_train_batch_size=64,\n",
" # gradient_accumulation_steps=2,\n",
" per_device_eval_batch_size=64,\n",
" num_train_epochs=1,\n",
" warmup_ratio=0.1,\n",
" logging_steps=10,\n",
" load_best_model_at_end=True,\n",
" metric_for_best_model=\"accuracy\",\n",
" push_to_hub=False,\n",
"\n",
")\n",
"\n",
"trainer = Trainer(\n",
" model=model,\n",
" args=training_args,\n",
" train_dataset=ds[\"train\"], # .select(range(100)),\n",
" eval_dataset=ds[\"valid\"], # .select(range(100)),\n",
" tokenizer=image_processor,\n",
" compute_metrics=compute_metrics,\n",
" data_collator=data_collator,\n",
")\n",
"\n",
"trainer.train()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Evaluation"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4979f1d5536f4a3e97ecbc36c7eebbfa",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/7 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'eval_loss': 8.275933265686035, 'eval_accuracy': 0.0, 'eval_runtime': 0.6419, 'eval_samples_per_second': 155.791, 'eval_steps_per_second': 10.905, 'epoch': 0.57}\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cf6f48e995bf427db3c86d1d988bf752",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/7 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"results = trainer.evaluate()\n",
"print(results)\n",
"\n",
"test_results = trainer.predict(ds[\"test\"].select(range(100)))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"EfficientNetForImageClassification(\n",
" (efficientnet): EfficientNetModel(\n",
" (embeddings): EfficientNetEmbeddings(\n",
" (padding): ZeroPad2d((0, 1, 0, 1))\n",
" (convolution): Conv2d(3, 40, kernel_size=(3, 3), stride=(2, 2), padding=valid, bias=False)\n",
" (batchnorm): BatchNorm2d(40, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (activation): SiLU()\n",
" )\n",
" (encoder): EfficientNetEncoder(\n",
" (blocks): ModuleList(\n",
" (0): EfficientNetBlock(\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(40, 40, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=40, bias=False)\n",
" (depthwise_norm): BatchNorm2d(40, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(40, 10, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(10, 40, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(40, 24, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(24, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.0, inplace=False)\n",
" )\n",
" )\n",
" (1): EfficientNetBlock(\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(24, 24, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=24, bias=False)\n",
" (depthwise_norm): BatchNorm2d(24, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(24, 6, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(6, 24, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(24, 24, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(24, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.007692307692307693, inplace=False)\n",
" )\n",
" )\n",
" (2): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(24, 144, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(144, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(144, 144, kernel_size=(3, 3), stride=(2, 2), padding=valid, groups=144, bias=False)\n",
" (depthwise_norm): BatchNorm2d(144, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(144, 6, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(6, 144, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(144, 32, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(32, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.015384615384615385, inplace=False)\n",
" )\n",
" )\n",
" (3): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(192, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=192, bias=False)\n",
" (depthwise_norm): BatchNorm2d(192, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(192, 8, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(8, 192, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(32, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.02307692307692308, inplace=False)\n",
" )\n",
" )\n",
" (4): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(192, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=192, bias=False)\n",
" (depthwise_norm): BatchNorm2d(192, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(192, 8, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(8, 192, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(32, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.03076923076923077, inplace=False)\n",
" )\n",
" )\n",
" (5): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(192, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((2, 2, 2, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(192, 192, kernel_size=(5, 5), stride=(2, 2), padding=valid, groups=192, bias=False)\n",
" (depthwise_norm): BatchNorm2d(192, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(192, 8, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(8, 192, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(192, 48, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(48, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.038461538461538464, inplace=False)\n",
" )\n",
" )\n",
" (6): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(48, 288, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(288, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(288, 288, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=288, bias=False)\n",
" (depthwise_norm): BatchNorm2d(288, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(288, 12, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(12, 288, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(288, 48, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(48, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.04615384615384616, inplace=False)\n",
" )\n",
" )\n",
" (7): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(48, 288, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(288, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(288, 288, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=288, bias=False)\n",
" (depthwise_norm): BatchNorm2d(288, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(288, 12, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(12, 288, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(288, 48, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(48, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.05384615384615385, inplace=False)\n",
" )\n",
" )\n",
" (8): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(48, 288, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(288, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(288, 288, kernel_size=(3, 3), stride=(2, 2), padding=valid, groups=288, bias=False)\n",
" (depthwise_norm): BatchNorm2d(288, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(288, 12, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(12, 288, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(288, 96, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(96, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.06153846153846154, inplace=False)\n",
" )\n",
" )\n",
" (9): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(576, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=576, bias=False)\n",
" (depthwise_norm): BatchNorm2d(576, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(576, 24, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(24, 576, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(96, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.06923076923076923, inplace=False)\n",
" )\n",
" )\n",
" (10): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(576, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=576, bias=False)\n",
" (depthwise_norm): BatchNorm2d(576, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(576, 24, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(24, 576, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(96, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.07692307692307693, inplace=False)\n",
" )\n",
" )\n",
" (11): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(576, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=576, bias=False)\n",
" (depthwise_norm): BatchNorm2d(576, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(576, 24, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(24, 576, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(96, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.08461538461538462, inplace=False)\n",
" )\n",
" )\n",
" (12): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(576, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=576, bias=False)\n",
" (depthwise_norm): BatchNorm2d(576, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(576, 24, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(24, 576, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(96, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.09230769230769233, inplace=False)\n",
" )\n",
" )\n",
" (13): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(576, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(576, 576, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=576, bias=False)\n",
" (depthwise_norm): BatchNorm2d(576, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(576, 24, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(24, 576, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(576, 136, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(136, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.1, inplace=False)\n",
" )\n",
" )\n",
" (14): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(136, 816, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(816, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(816, 816, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=816, bias=False)\n",
" (depthwise_norm): BatchNorm2d(816, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(816, 34, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(34, 816, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(816, 136, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(136, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.1076923076923077, inplace=False)\n",
" )\n",
" )\n",
" (15): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(136, 816, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(816, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(816, 816, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=816, bias=False)\n",
" (depthwise_norm): BatchNorm2d(816, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(816, 34, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(34, 816, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(816, 136, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(136, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.11538461538461539, inplace=False)\n",
" )\n",
" )\n",
" (16): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(136, 816, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(816, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(816, 816, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=816, bias=False)\n",
" (depthwise_norm): BatchNorm2d(816, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(816, 34, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(34, 816, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(816, 136, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(136, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.12307692307692308, inplace=False)\n",
" )\n",
" )\n",
" (17): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(136, 816, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(816, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(816, 816, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=816, bias=False)\n",
" (depthwise_norm): BatchNorm2d(816, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(816, 34, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(34, 816, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(816, 136, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(136, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.13076923076923078, inplace=False)\n",
" )\n",
" )\n",
" (18): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(136, 816, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(816, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((2, 2, 2, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(816, 816, kernel_size=(5, 5), stride=(2, 2), padding=valid, groups=816, bias=False)\n",
" (depthwise_norm): BatchNorm2d(816, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(816, 34, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(34, 816, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(816, 232, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(232, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.13846153846153847, inplace=False)\n",
" )\n",
" )\n",
" (19): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(232, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(1392, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(1392, 1392, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=1392, bias=False)\n",
" (depthwise_norm): BatchNorm2d(1392, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(1392, 58, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(58, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(1392, 232, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(232, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.14615384615384616, inplace=False)\n",
" )\n",
" )\n",
" (20): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(232, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(1392, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(1392, 1392, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=1392, bias=False)\n",
" (depthwise_norm): BatchNorm2d(1392, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(1392, 58, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(58, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(1392, 232, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(232, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.15384615384615385, inplace=False)\n",
" )\n",
" )\n",
" (21): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(232, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(1392, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(1392, 1392, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=1392, bias=False)\n",
" (depthwise_norm): BatchNorm2d(1392, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(1392, 58, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(58, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(1392, 232, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(232, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.16153846153846155, inplace=False)\n",
" )\n",
" )\n",
" (22): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(232, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(1392, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(1392, 1392, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=1392, bias=False)\n",
" (depthwise_norm): BatchNorm2d(1392, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(1392, 58, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(58, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(1392, 232, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(232, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.16923076923076924, inplace=False)\n",
" )\n",
" )\n",
" (23): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(232, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(1392, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((1, 2, 1, 2))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(1392, 1392, kernel_size=(5, 5), stride=(1, 1), padding=same, groups=1392, bias=False)\n",
" (depthwise_norm): BatchNorm2d(1392, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(1392, 58, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(58, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(1392, 232, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(232, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.17692307692307693, inplace=False)\n",
" )\n",
" )\n",
" (24): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(232, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(1392, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(1392, 1392, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=1392, bias=False)\n",
" (depthwise_norm): BatchNorm2d(1392, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(1392, 58, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(58, 1392, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(1392, 384, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(384, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.18461538461538465, inplace=False)\n",
" )\n",
" )\n",
" (25): EfficientNetBlock(\n",
" (expansion): EfficientNetExpansionLayer(\n",
" (expand_conv): Conv2d(384, 2304, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (expand_bn): BatchNorm2d(2304, eps=0.001, momentum=0.1, affine=True, track_running_stats=True)\n",
" (expand_act): SiLU()\n",
" )\n",
" (depthwise_conv): EfficientNetDepthwiseLayer(\n",
" (depthwise_conv_pad): ZeroPad2d((0, 1, 0, 1))\n",
" (depthwise_conv): EfficientNetDepthwiseConv2d(2304, 2304, kernel_size=(3, 3), stride=(1, 1), padding=same, groups=2304, bias=False)\n",
" (depthwise_norm): BatchNorm2d(2304, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (depthwise_act): SiLU()\n",
" )\n",
" (squeeze_excite): EfficientNetSqueezeExciteLayer(\n",
" (squeeze): AdaptiveAvgPool2d(output_size=1)\n",
" (reduce): Conv2d(2304, 96, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (expand): Conv2d(96, 2304, kernel_size=(1, 1), stride=(1, 1), padding=same)\n",
" (act_reduce): SiLU()\n",
" (act_expand): Sigmoid()\n",
" )\n",
" (projection): EfficientNetFinalBlockLayer(\n",
" (project_conv): Conv2d(2304, 384, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (project_bn): BatchNorm2d(384, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (dropout): Dropout(p=0.19230769230769232, inplace=False)\n",
" )\n",
" )\n",
" )\n",
" (top_conv): Conv2d(384, 1536, kernel_size=(1, 1), stride=(1, 1), padding=same, bias=False)\n",
" (top_bn): BatchNorm2d(1536, eps=0.001, momentum=0.99, affine=True, track_running_stats=True)\n",
" (top_activation): SiLU()\n",
" )\n",
" (pooler): AvgPool2d(kernel_size=1536, stride=1536, padding=0)\n",
" )\n",
" (dropout): Dropout(p=0.3, inplace=False)\n",
" (classifier): Linear(in_features=1536, out_features=3872, bias=True)\n",
")"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "ArtifactClassification",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|