How can I set product images to change based on collection?

Sure, here’s an edited version of what I wrote above. Basically you could tag those products with “unisex” and then check for that tag before applying the logic.

{% if collection.url contains '/mens' and product.tags contains "unisex" %}
  {% include 'rimg', img: product.images[1].src, size: '512x', lazy: true, canvas: true %}
{% else %}
  {% if product_grid_show_second_image and product.images.size > 1 %}
    {% include 'rimg', img: product.images[1].src, size: '512x', lazy: true, class: 'productitem--image-alternate', canvas: true %}
  {% endif %}
  {% include 'rimg', img: product.featured_image, size: '512x', lazy: true, canvas: true %}
{% endif %}