Some pixels doesn't render on the image ID MASK LOOK FOR BOX TYPE IMAGES

I need to annotate each SINGLE plant separately from others, for accurate annotation, right now I've it scripted for ID MASK. It gives each object from a specifically named collection iterated ID pass, renders original scene in .png, and then renders and converts pixels (every pixel, which is not black) from every ID MASK image to .json. But as you can see it doesn't works as expected. Is there something similar I could do with cryptomatte? Again, For annotation I need to know in advance which objects which color will use or something like that to know exactly or define an object. maybe I can adjust emission shader or make my own so it can handle transparent textures correctly as well? or something along those lines 
 
UPD cryptomatte works only when I render plants separately from scene
Look here cryptomatte whole scene vs cryptomatte plants only



Blender doesn't render all pixels on distant objects, it gets better when I make resolution higher, like 4k, but it doesnt fixes my problem, but makes image pixels better. Also raising sample doesnt help. I tried to render with denoising and AA in compositor, that didnt help.
How can I fix this, so it will render all object pixels on ID MASK using box pixel type? I need an alpha of an object as an ID MASK, for accurate object annotation.

Render Settings

Engine: Cycles

Render Resolution: 1280x720

Samples: 128

Pixel type: Blackman-Harris

Pixel width: 0.01

Full Image:

Problem: 

Additional info: ID_MASK of the object in compositor


Box type pixels looks so much better on the Image, but ID Mask dont recognize them, now how to fix this one?

Box type render:


Box Type ID Mask:

Box type Render 4k:


Box type 4k ID MASK:


Annotations

Here's an addon, which do almost what I needed, but it uses emission shader, which doesnt work with custom textures.

By annotation I mean assigning each pixel of the original (rendered) image a corresponding value of instanceId

Where instanceId maps a specific blender object.



Here's more examples:
Original Image without annotations:

Annotated Image:



For now I just need objectId and categories.

Right now I'm using ID masks which is the only reliable solution I've come up with.

As you can see I've tried a lot of other options such as:
Cryptomatte
Emission shader
Denoising
Playing with AlphaTreshold

Since ID masks don't work as reliable as I thought they would. I was thinking about writing my own shader that will use emission (to get the perfect color) and some magic to fix the transparent textures.

Here's why emission shader won't work in any case:




I know I should start a new question, but... how to achive a solid color with nodes? If there's a way to get a fully opaque color w/o aa or any kind of transparency? That would solve my problem perfectly.
Here's my node attempt:



Cryptomatte did the job, but it needs a manual nodes pre-setup
Don't use ID Masks
Just don't. They have little use, this is a really poorly designed feature. You simply cannot make a good mask with a 2bit color depth image.
Cryptomatte is the solution
Look into using Cryptomatte. You need to enable it's layers in the View Layer properties tab:

You can then get any masks easily using Cryptomatte node in the compositor and they will be a lot higher quality: