General course chat

You can remove the warnings by following @oo92’s instructions here. This means
adding a new cell after the colab setup statement and running the command
!pip install "torch==1.4" "torchvision==0.5.0"

[^/] is saying match any character that is not a slash .
[^/]+ is saying match 1 or more characters that is not a slash
([^/]+) is saying group the set that matches 1 or more characters that is not a slash
/([^/]+)_ is saying group the set that matches 1 or more characters that is not a slash but is prefixed by a slash and followed by an underscore .This will filter out any matches on the directory path (which do have slashes) if they dont have underscores. It will only match the filename which has an underscore to separate a digit from the name of the species..
/([^/]+)_\d+ is saying the same as above plus should be followed by 1 or more digits
/([^/]+)_\d+.jpg is saying the same as above plus should be followed by any character plus the sequence jpg
/([^/]+)_\d+.jpg$ is saying the same as above but followed by the end of the string (ie. no more characters).

Regexes are complicated to grok and it took me a while to understand them too. There are websites that allow you to play with regexes and can help you debug them if you are still having problems.

Hope this helps.

Best regards,
Butch

5 Likes