Your submission will get points for correctly determining, which frames have loot, enemies, and for correctly segmenting loot and enemies.

Since the monsters are very scary, detecting them on the image and segmenting them correctly is of great importance. Therefore, segmenting monster(s) from a frame that has monster(s) in it gives a whopping IoU * 20 points. However, most frames do not have any monsters in them, and it’s better if your submission does not create false alarms. This is why correctly guessing that a frame that has no monsters, by submitting an empty mask (mask with all pixels turned off), gives 1 point.

Segmenting loot gives IoU * 8 points for every frame. Correctly deducing that a frame has no loot gives 1 point.

Your total score is just the sum of the points that your solution has collected. For example, a solution that never predicts any loot or monsters gets 10530 points on the public (preliminary) test.

Across both the public and hidden test, 42.69% of points are assigned for correctly segmenting loot, around 28% for segmenting enemies and around 29% for detecting the absence of loot and absence of enemies.

---


## Submission File
To submit your answer, the submission .csv file should have 3 columns: picture name (`img_id`), enemies mask (`enemy_rle`) and loot mask (`loot_rle`). The masks have to be encoded as RLE (run-length encoding). 
``` python
from pycocotools import mask as coco_mask
import zlib
import base64

def encode_mask(mask: np.ndarray):
  """Encode numpy arrays (unit8 or boolean) to compressed base64 encoded RLE strings

  Depends on pycocotools
  Ex:
  `encode_mask(mask_tesnor.numpy())`
  """
  rle = coco_mask.encode(np.asfortranarray(mask))["counts"]
  return base64.b64encode(zlib.compress(rle)).decode('utf-8')
```
**NB!** make sure your predicted & encoded mask resolutions match with input image resolutions (860(w)x520(h))

Example on how you can turn your predicted masks into a RLE is also shown in the starter notebook. You can also check metric code for the decoding process & score calculation - [dl4cv-10-2-class-iou-sum-with-coef-metric](https://www.kaggle.com/code/margusl/dl4cv-10-2-class-iou-sum-with-coef-metric) (competition is set up to use default arguments of the`score()` function)

The submission file should look something like this:
``` csv
img_id,enemy_rle,loot_rle
3631_0007845.png,eJwLSE+xBQADfgFZ,eJwLSE+xBQADfgFZ
3631_0007860.png,eJwLSE+xBQADfgFZ,eJwLSE+xBQADfgFZ
3631_0007875.png,eJwLSE+xBQADfgFZ,eJwLSE+xBQADfgFZ
3631_0007890.png,eJwLSE+xBQADfgFZ,eJwLSE+xBQADfgFZ
3631_0007905.png,eJwLSE+xBQADfgFZ,eJwLSE+xBQADfgFZ
```