How can we identify ERC20 and ERC721 contract

How can we identify the Transfer event is from a ERC20 or ERC721 contract?
It’s because both contract have same Transfer events

You would need to check out the code in the contract itself to know. There may be other events in the ERC721 that signify it, but it’s entirely up to the developer and contract maker.

You can use ERC165 to query if the contract is ERC721.