Weakly connected oscillatory networks for dynamic pattern recognition