In this study, the influence of porous non-metallic balls on the dynamics of detonation propagation in hydrogen–oxygen mixtures is studied in stainless steel tubes with square cross-sections. The effect of the length and thickness of the balls is considered in detail. Four pressure transducers are used to record the detonation time-of-arrival, and the average velocity of detonation propagation is calculate. The smoked foil technique is performed to register the detonation cellular structures. The results indicate that increasing the filling length and thickness of the balls leads to a significant increase in velocity loss, critical pressure, and re-initiation distance during detonation propagation. Two propagation modes are observed near the critical pressure. In sub-critical mode, the detonation wave is attenuated and failed eventually, propagating to the end of the tube in the form of a low-speed deflagration wave. In super-critical mode, the detonation propagation can be promoted by inducing a vertical transverse wave generated by the detonation wave passing through a group of small balls. It is worth noting that the increase in filling thickness of the small balls leads to a greater velocity loss compared to the increase in filling length. However, an increase in the filling length will cause the detonation wave to undergo a longer and more sustained weakening process as it passes through the small balls, thereby resulting in a longer re-initiation distance and a lower average velocity over a short distance after re-initiation. By increasing the filling length of the small balls to 312 mm, the transition of the detonation wave from multi-head detonation to double-head detonation can be observed, and then successfully turns into stable detonation. However, when filling double-layer small balls, even in super-critical conditions, the attenuated detonation wave cannot achieve re-initiation over a short distance.