updates
This commit is contained in:
		
							parent
							
								
									19d2232665
								
							
						
					
					
						commit
						8f609246db
					
				
							
								
								
									
										7
									
								
								train.py
								
								
								
								
							
							
						
						
									
										7
									
								
								train.py
								
								
								
								
							|  | @ -74,8 +74,9 @@ def train( | |||
|     device = torch_utils.select_device() | ||||
|     torch.backends.cudnn.benchmark = True  # possibly unsuitable for multiscale | ||||
|     img_size_test = img_size  # image size for testing | ||||
|     multi_scale = not opt.single_scale | ||||
| 
 | ||||
|     if opt.multi_scale: | ||||
|     if multi_scale: | ||||
|         img_size_min = round(img_size / 32 / 1.5) | ||||
|         img_size_max = round(img_size / 32 * 1.5) | ||||
|         img_size = img_size_max * 32  # initiate with maximum multi_scale size | ||||
|  | @ -203,7 +204,7 @@ def train( | |||
|             targets = targets.to(device) | ||||
| 
 | ||||
|             # Multi-Scale training | ||||
|             if opt.multi_scale: | ||||
|             if multi_scale: | ||||
|                 if (i + 1 + nb * epoch) % 10 == 0:  #  adjust (67% - 150%) every 10 batches | ||||
|                     img_size = random.choice(range(img_size_min, img_size_max + 1)) * 32 | ||||
|                     print('img_size = %g' % img_size) | ||||
|  | @ -310,7 +311,7 @@ if __name__ == '__main__': | |||
|     parser.add_argument('--accumulate', type=int, default=8, help='number of batches to accumulate before optimizing') | ||||
|     parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path') | ||||
|     parser.add_argument('--data-cfg', type=str, default='data/coco_64img.data', help='coco.data file path') | ||||
|     parser.add_argument('--multi-scale', action='store_true', help='random image sizes per batch 320 - 608') | ||||
|     parser.add_argument('--single-scale', action='store_true', help='train at fixed size (no multi-scale)') | ||||
|     parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)') | ||||
|     parser.add_argument('--resume', action='store_true', help='resume training flag') | ||||
|     parser.add_argument('--transfer', action='store_true', help='transfer learning flag') | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue