SPG icon indicating copy to clipboard operation
SPG copied to clipboard

AttributeError: 'NoneType' object has no attribute 'num_classes'

Open Rahul-Venugopal opened this issue 5 years ago • 1 comments

Hi ,

I am running

python demo_image.py --image_name 'ILSVRC2012_val_00000004.JPEG'

and I am getting an error

Namespace(image_name='ILSVRC2012_val_00000004.JPEG', img_dir='examples/', input_size=321, num_classes=1000, save_dir='examples/results/', save_spg_c=True, snapshots='snapshots/imagenet_epoch_2_glo_step_128118.pth.tar', top_k=1)
Traceback (most recent call last):
  File "demo_image.py", line 69, in <module>
    model = load_model(args)
  File "demo_image.py", line 39, in load_model
    model = inceptionv3_spg.Inception3(num_classes=args.num_classes, threshold=0.5)
  File "/home/rahul/ActiveShuttle/WSOL/ACOL_SPG/SPG-master/models/google/inception3_spg.py", line 93, in __init__
    self.num_classes = args.num_classes
AttributeError: 'NoneType' object has no attribute 'num_classes'

Can anyone please help to find the problem ?

Thanks Rahul

Rahul-Venugopal avatar Apr 30 '19 13:04 Rahul-Venugopal

You might solve the problem.

https://github.com/xiaomengyc/SPG/blob/c193257eb12d08055ce7f0b1cda9c99908dd33c3/models/google/inception3_spg.py#L93

This line should be modified into

self.num_classes = num_classes

halbielee avatar Aug 12 '19 04:08 halbielee