revised for_dataset.py (It took too many time)