Yes, God does know we aren't perfect, either in our actions or our thoughts. The Bible says, "He knows the secrets of the heart" (Psalm 44:21).
But that doesn't excuse us or make us any less guilty when we do wrong. On a human level, if someone commits a crime, we don't excuse it by saying, "Oh well, none of us is perfect." Nor do we say they don't need to pay the penalty for what they've done. They made a choice to do something they knew was wrong -- and society demands they pay the price for that decision.
The same is true with us. God has told us what is right and what is wrong, and when we intentionally turn against Him and ignore what He has told us, we alone are responsible, and we must pay the price. We pay the price right now, because sin always has consequences. And we pay the price in eternity, for God has warned us that sin will be judged. The Bible says that God "has set a day when he will judge the world with justice" (Acts 17:31).
Does this mean there is no hope for us? No! God loves us, in spite of our sin, and He has provided the way for us to be forgiven and cleansed and saved. That way is Jesus, who gave His life for our salvation. Confess your sins and ask Him to come into your life today.