How to replace multiple values in an large array with the occurrence of the value?

@JeffreySarnoff, thanks for your time and answer, but it issues error messages:

function elcount6!(blobs, blobs_occ)
    @inbounds for j in axes(blobs,2), i in axes(blobs,1)
        blobs[i,j] = blobs_occ[blobs[i,j]];
    end
    return blobs
end

blobs = rand(0:9,10_000,10_000);
blobs_occ = countmap(vec(blobs))
@btime elcount6!($blobs, $blobs_occ)

julia> @btime elcount6!($blobs, $blobs_occ)
ERROR: KeyError: key 10002175 not found
Stacktrace:
 [1] getindex at .\dict.jl:467 [inlined]
 ...

Some setup seems to be required to @btime in-place modifying functions but I did not figure out yet how to do it for the function above.