I use Privoxy to filter out banner adverts when I'm browsing the web. It does a pretty good job, but there are inevitably a few false positives: valid images that get blocked.
Since I'm filtering adverts mostly to reduce visual noise, an alternative approach would be to fade out rather than completely remove images that are likely to be adverts. This could be done by converting the images to a format that supports alpha blending (like PNG), then setting the image to be, say, 95% transparent. Some HTML/CSS manipulation would make it possible to bring the image up to full opacity when hovered over, making it easy to see images that had been faded out.
The best place to do this might be in the browser, rather than in a proxy; you should be able to do most of it with a user stylesheet in Mozilla provided you can express your advert detection rules as CSS patterns.