What do you call a chord made of a diminished triad with a sixth on top?! I've marked the chords in red; would it be considered a G7 in this example?
The second most definitely, as it resolves in the next bar to C minor, G7 being the V of Cm, the key of the excerpt.
The first one isn't G7 - it comprises B D F♯ G, making it probably Gmaj7. (The F note is sharpened because of the previous F note's accidental). And that goes straight to F minor, which isn't what dominant seventh chords generally do - except in Blues, but then Fm wouldn't really feature too much.
I think you are overlooking how the accidentals apply within each measure.
In the first measure the
F in the
D major chord is sharp, and that sharp applies to the rest of the measure, so the chord you marked in red is actually
B D F# a minor triad with a
G above. That will probably sound like
But in the second measure the
F has a natural. It applies to the whole measure. So the chord you marked in red in the second measure is
B D Fa diminished triad with
G B above. That chord is
You actually have two different kinds of
G seventh chords.
Actually the natural sign on the
F in measure 2 is redundant. Each new measure sort of "resets" the sharps and flats to the key signature, so the flat isn't necessary in measure 2. You can call such accidentals "courtesy accidentals" as they are a kind of reminder to the reader. Usually they are put in parenthesis to show they are redundant.
Accidentals apply to specific octaves. So if the
Fs in measure two, first chord, are meant to both be natural, the lower
F3 should also get an accidental.