@talhak Firstly a forward hook should be attached to a module before its forward call. In the above code, you first do output = model(images)  # forward and then model.conv1[0].register_forward_hook(get_activation('conv1')). Even though this doesn’t call hook() during the first forward call to conv1, subsequent forward calls will invoke hook. Also you register a hook for every batch_idx % log_interval which is not required.
Coming to visualization of activation maps, can you let know the shape of the conv1 output?
Problem might occur because the conv outputs are in the order C, H, W whereas the image plot expects H, W, C(Note: if C=1, then it shouldn’t cause issues since you do squeeze anyway)