Discovery of painter styles and motifs

SetDirectory["~/courses/MATH547ML/data/paintings"];
PaintingDataFiles=FileNames[];nPaintings = Length[PaintingDataFiles]

Manipulate[Import[PaintingDataFiles[[k]]],{k,1,nPaintings,1}]

ArtistWorks=Map[StringSplit[StringReplace[#,{"_"->" ",".jpg"->""}]]&,PaintingDataFiles];

ArtistLastNames=DeleteDuplicates[Map[ If[Length[#]==3,#[[2]],#[[1]]]&,ArtistWorks]];

nArtists=Length[ArtistLastNames]; nColumns=5;
TableForm[ArrayReshape[ArtistLastNames,{Ceiling[nArtists/nColumns],nColumns}]]

ArtistPaintings[Artist_]:=Module[{positions,paintings},
positions=Transpose[Position[ArtistWorks,Artist]][[1]];
paintings=Map[Import[PaintingDataFiles[[#]]]&,positions];
Return[paintings]
]

MonetPaintings=ArtistPaintings["Monet"];
SeuratPaintings=ArtistPaintings["Seurat"];

nMonet = Length[MonetPaintings]; nSeurat = Length[SeuratPaintings]; {nMonet,nSeurat}

Manipulate[GraphicsGrid[{{MonetPaintings[[k]],SeuratPaintings[[k]]}}],{k,1,Min[nMonet,nSeurat],1}]

PrincipalValueImage[image_,k_]:=Module[{data,Rdata,Gdata,Bdata,UR,SR,VR,UG,SG,VG,UB,SB,VB,Rkdata,Gkdata,Bkdata,imk},
data=ImageData[image];
Rdata=data[[;;,;;,1]];
Gdata=data[[;;,;;,2]];
Bdata=data[[;;,;;,3]];
{UR,SR,VR}=SingularValueDecomposition[Rdata,UpTo[k]]; 
{UG,SG,VG}=SingularValueDecomposition[Gdata,UpTo[k]]; 
{UB,SB,VB}=SingularValueDecomposition[Bdata,UpTo[k]]; 
Rkdata=Transpose[UR.SR.Transpose[VR]];
Gkdata=Transpose[UG.SG.Transpose[VG]];
Bkdata=Transpose[UB.SB.Transpose[VB]];
imk=Transpose[{Rkdata,Gkdata,Bkdata},1<->3];
Return[Image[imk]];
]

Animate[PrincipalValueImage[SeuratPaintings[[16]],k],{k,1,50,1}]

ImagePrincipalValues[image_,k_]:=Module[{data,Rdata,Gdata,Bdata,UR,SR,VR,UG,SG,VG,UB,SB,VB,Rkdata,Gkdata,Bkdata,imk,RGBk},
data=ImageData[image];
Rdata=data[[;;,;;,1]];
Gdata=data[[;;,;;,2]];
Bdata=data[[;;,;;,3]];
{UR,SR,VR}=SingularValueDecomposition[Rdata,k]; 
{UG,SG,VG}=SingularValueDecomposition[Gdata,k]; 
{UB,SB,VB}=SingularValueDecomposition[Bdata,k];
RGBk=SR[[k,k]] Outer[Times,UR[[k]],VR[[k]]];
Return[{UR,SR,VR}];
]

s16=ImagePrincipalValues[SeuratPaintings[[16]],20]

Dimensions[s16[[1]]]