{
  "id": 583293,
  "title": "136->50 Completely based on open-source models",
  "url": "/competitions/byu-locating-bacterial-flagellar-motors-2025/discussion/583293",
  "author_name": "",
  "post_date": "2025-06-06T00:27:21.790646200Z",
  "votes": 2,
  "comment_count": 3,
  "views": 0,
  "content": "<p>My work is completely based on the open-source MHAFyolo model with TTA, achieving a highest LB of 0.829 (PB 0.812) and 0.827 (PB 0.813, not selected), without using any extra data. It is a very simple solution focusing mainly on two aspects:</p>\n<ol>\n<li>Parameter selection based on Optuna is effective. By using recall as the optimization metric locally, it’s possible to find a range where recall reaches 1. Using the F2 score as the optimization metric did not yield good results. Afterwards, I kept submitting within this range and experimenting.<br>\n<code>CONFIDENCE_THRESHOLD=0.776,\n        NMS_IOU_THRESHOLD=0.22,\n        CONCENTRATION=0.886,\n        IOU_THRESHOLD=0.4,</code></li>\n<li>Introducing more variations in TTA, such as contrast and brightness shifts (including a contrast enhancement with alpha=1.02 during inference on the original images), should be noted. The impact of resolution seems to be minimal, and lowering the resolution does not provide enough extra time to perform more TTAs(but in my experment, if your model is small enough, increasing the resolution at high resolutions does yield noticeable improvements).<br>\nDifferent TTA settings use different values; alpha should not be greater than 1.05, and beta should be less than 0, but the choice of values needs to be made carefully.<br>\n<code>def do_infer(img_tta, alpha, beta, invert_func, tta_vf_size=1):\n        res = single_model(enhance_contrast_cv2(img_tta,alpha=alpha,beta=beta), \n                        imgsz=img_size, \n                        device=device, \n                        verbose=False)\n        for r in res:\n            boxes = r.boxes\n            if boxes is None or len(boxes)==0:\n                continue\n            xyxy = boxes.xyxy.cpu().numpy()\n            confs = boxes.conf.cpu().numpy()\n            clss = boxes.cls.cpu().numpy().astype(int)\n            xyxy_orig = invert_func(xyxy)\n            all_boxes.append(xyxy_orig)\n            all_confs.append(confs)\n            all_clss.append(clss)\n</code><br>\nAnd if you continue training based on an open-source model using continual learning with extra data, the original data in the mixed dataset should account for more than 20%. The constant before the KL divergence term in the constructed loss function should preferably be greater than 1.5, and certain parameters should be frozen; otherwise, catastrophic forgetting is very likely to occur. (Without using extra data and only modifying TTA and optimizing parameters, it is still possible to achieve PB above 0.813).</li>\n</ol>",
  "messages": [
    {
      "id": "3218182",
      "postDate": "06/06/2025 00:27:21",
      "content": "<p>My work is completely based on the open-source MHAFyolo model with TTA, achieving a highest LB of 0.829 (PB 0.812) and 0.827 (PB 0.813, not selected), without using any extra data. It is a very simple solution focusing mainly on two aspects:</p>\n<ol>\n<li>Parameter selection based on Optuna is effective. By using recall as the optimization metric locally, it’s possible to find a range where recall reaches 1. Using the F2 score as the optimization metric did not yield good results. Afterwards, I kept submitting within this range and experimenting.<br>\n<code>CONFIDENCE_THRESHOLD=0.776,\n        NMS_IOU_THRESHOLD=0.22,\n        CONCENTRATION=0.886,\n        IOU_THRESHOLD=0.4,</code></li>\n<li>Introducing more variations in TTA, such as contrast and brightness shifts (including a contrast enhancement with alpha=1.02 during inference on the original images), should be noted. The impact of resolution seems to be minimal, and lowering the resolution does not provide enough extra time to perform more TTAs(but in my experment, if your model is small enough, increasing the resolution at high resolutions does yield noticeable improvements).<br>\nDifferent TTA settings use different values; alpha should not be greater than 1.05, and beta should be less than 0, but the choice of values needs to be made carefully.<br>\n<code>def do_infer(img_tta, alpha, beta, invert_func, tta_vf_size=1):\n        res = single_model(enhance_contrast_cv2(img_tta,alpha=alpha,beta=beta), \n                        imgsz=img_size, \n                        device=device, \n                        verbose=False)\n        for r in res:\n            boxes = r.boxes\n            if boxes is None or len(boxes)==0:\n                continue\n            xyxy = boxes.xyxy.cpu().numpy()\n            confs = boxes.conf.cpu().numpy()\n            clss = boxes.cls.cpu().numpy().astype(int)\n            xyxy_orig = invert_func(xyxy)\n            all_boxes.append(xyxy_orig)\n            all_confs.append(confs)\n            all_clss.append(clss)\n</code><br>\nAnd if you continue training based on an open-source model using continual learning with extra data, the original data in the mixed dataset should account for more than 20%. The constant before the KL divergence term in the constructed loss function should preferably be greater than 1.5, and certain parameters should be frozen; otherwise, catastrophic forgetting is very likely to occur. (Without using extra data and only modifying TTA and optimizing parameters, it is still possible to achieve PB above 0.813).</li>\n</ol>",
      "rawMarkdown": "My work is completely based on the open-source MHAFyolo model with TTA, achieving a highest LB of 0.829 (PB 0.812) and 0.827 (PB 0.813, not selected), without using any extra data. It is a very simple solution focusing mainly on two aspects:\n1. Parameter selection based on Optuna is effective. By using recall as the optimization metric locally, it’s possible to find a range where recall reaches 1. Using the F2 score as the optimization metric did not yield good results. Afterwards, I kept submitting within this range and experimenting.\n`            CONFIDENCE_THRESHOLD=0.776,\n            NMS_IOU_THRESHOLD=0.22,\n            CONCENTRATION=0.886,\n            IOU_THRESHOLD=0.4,`\n2. Introducing more variations in TTA, such as contrast and brightness shifts (including a contrast enhancement with alpha=1.02 during inference on the original images), should be noted. The impact of resolution seems to be minimal, and lowering the resolution does not provide enough extra time to perform more TTAs(but in my experment, if your model is small enough, increasing the resolution at high resolutions does yield noticeable improvements).\nDifferent TTA settings use different values; alpha should not be greater than 1.05, and beta should be less than 0, but the choice of values needs to be made carefully.\n`    def do_infer(img_tta, alpha, beta, invert_func, tta_vf_size=1):\n            res = single_model(enhance_contrast_cv2(img_tta,alpha=alpha,beta=beta), \n                            imgsz=img_size, \n                            device=device, \n                            verbose=False)\n            for r in res:\n                boxes = r.boxes\n                if boxes is None or len(boxes)==0:\n                    continue\n                xyxy = boxes.xyxy.cpu().numpy()\n                confs = boxes.conf.cpu().numpy()\n                clss = boxes.cls.cpu().numpy().astype(int)\n                xyxy_orig = invert_func(xyxy)\n                all_boxes.append(xyxy_orig)\n                all_confs.append(confs)\n                all_clss.append(clss)\n`\nAnd if you continue training based on an open-source model using continual learning with extra data, the original data in the mixed dataset should account for more than 20%. The constant before the KL divergence term in the constructed loss function should preferably be greater than 1.5, and certain parameters should be frozen; otherwise, catastrophic forgetting is very likely to occur. (Without using extra data and only modifying TTA and optimizing parameters, it is still possible to achieve PB above 0.813).",
      "votes": null
    },
    {
      "id": "3218264",
      "postDate": "06/06/2025 03:28:01",
      "content": "<p>Good job bro</p>",
      "rawMarkdown": "Good job bro",
      "votes": null
    },
    {
      "id": "3218386",
      "postDate": "06/06/2025 05:58:53",
      "content": "<p>nice work!</p>",
      "rawMarkdown": "nice work!",
      "votes": null
    },
    {
      "id": "3218417",
      "postDate": "06/06/2025 06:55:25",
      "content": "<p>Thank you for your notebook, it's really helpful!</p>",
      "rawMarkdown": "Thank you for your notebook, it's really helpful!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3218264,
      "author_name": "youkewei",
      "author_url": "",
      "post_date": "06/06/2025 03:28:01",
      "content": "<p>Good job bro</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 3218386,
      "author_name": "playwithme",
      "author_url": "",
      "post_date": "06/06/2025 05:58:53",
      "content": "<p>nice work!</p>",
      "votes": null,
      "replies": [
        {
          "id": 3218417,
          "author_name": "jezzlin",
          "author_url": "",
          "post_date": "06/06/2025 06:55:25",
          "content": "<p>Thank you for your notebook, it's really helpful!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3218182": "My work is completely based on the open-source MHAFyolo model with TTA, achieving a highest LB of 0.829 (PB 0.812) and 0.827 (PB 0.813, not selected), without using any extra data. It is a very simple solution focusing mainly on two aspects:\n1. Parameter selection based on Optuna is effective. By using recall as the optimization metric locally, it’s possible to find a range where recall reaches 1. Using the F2 score as the optimization metric did not yield good results. Afterwards, I kept submitting within this range and experimenting.\n`            CONFIDENCE_THRESHOLD=0.776,\n            NMS_IOU_THRESHOLD=0.22,\n            CONCENTRATION=0.886,\n            IOU_THRESHOLD=0.4,`\n2. Introducing more variations in TTA, such as contrast and brightness shifts (including a contrast enhancement with alpha=1.02 during inference on the original images), should be noted. The impact of resolution seems to be minimal, and lowering the resolution does not provide enough extra time to perform more TTAs(but in my experment, if your model is small enough, increasing the resolution at high resolutions does yield noticeable improvements).\nDifferent TTA settings use different values; alpha should not be greater than 1.05, and beta should be less than 0, but the choice of values needs to be made carefully.\n`    def do_infer(img_tta, alpha, beta, invert_func, tta_vf_size=1):\n            res = single_model(enhance_contrast_cv2(img_tta,alpha=alpha,beta=beta), \n                            imgsz=img_size, \n                            device=device, \n                            verbose=False)\n            for r in res:\n                boxes = r.boxes\n                if boxes is None or len(boxes)==0:\n                    continue\n                xyxy = boxes.xyxy.cpu().numpy()\n                confs = boxes.conf.cpu().numpy()\n                clss = boxes.cls.cpu().numpy().astype(int)\n                xyxy_orig = invert_func(xyxy)\n                all_boxes.append(xyxy_orig)\n                all_confs.append(confs)\n                all_clss.append(clss)\n`\nAnd if you continue training based on an open-source model using continual learning with extra data, the original data in the mixed dataset should account for more than 20%. The constant before the KL divergence term in the constructed loss function should preferably be greater than 1.5, and certain parameters should be frozen; otherwise, catastrophic forgetting is very likely to occur. (Without using extra data and only modifying TTA and optimizing parameters, it is still possible to achieve PB above 0.813).",
    "3218264": "Good job bro",
    "3218386": "nice work!",
    "3218417": "Thank you for your notebook, it's really helpful!"
  },
  "source": "meta"
}