Comments (5)
Hey, in src/evaluater/predict.py
you can see how the NIMA model class is being used to load the pre-trained weights from models/MobileNet
For example, to load the aesthetic weights you could run (ensure that your working directory is src
)
from handlers.model_builder import Nima
nima = Nima('MobileNet', weights=None)
nima.build()
nima.nima_model.load_weights('../models/MobileNet/weights_mobilenet_aesthetic_0.07.hdf5')
nima.nima_model.summary()
Hope this helps
from image-quality-assessment.
The model input dimensions are [batch size, 224, 224, 3], i.e. the images are resized to 224x224
from image-quality-assessment.
Thanks for the response. I am getting the following error from the command mentioned:
base = mobilenet.MobileNet(input_shape=(224, 224, 3), include_top=True, weights='weights_mobilenet_aesthetic_0.07.hdf5')
Error Trail
<ipython-input-5-635740cf9285> in <module>()
----> 1 base = mobilenet.MobileNet(input_shape=(224, 224, 3), include_top=True, weights='weights_mobilenet_aesthetic_0.07.hdf5')
path-to-keras\keras_applications\mobilenet.py in MobileNet(input_shape, alpha, depth_multiplier, dropout, include_top, weights, input_tensor, pooling, classes)
322 model.load_weights(weights_path)
323 elif weights is not None:
--> 324 model.load_weights(weights)
325
326 if old_data_format:
path-to-keras\keras\engine\network.py in load_weights(self, filepath, by_name, skip_mismatch, reshape)
1159 else:
1160 saving.load_weights_from_hdf5_group(
-> 1161 f, self.layers, reshape=reshape)
1162
1163 def _updated_config(self):
path-to-keras\keras\engine\saving.py in load_weights_from_hdf5_group(f, layers, reshape)
913 original_keras_version,
914 original_backend,
--> 915 reshape=reshape)
916 if len(weight_values) != len(symbolic_weights):
917 raise ValueError('Layer #' + str(k) +
path-to-keras\keras\engine\saving.py in preprocess_weights_for_loading(layer, weights, original_keras_version, original_backend, reshape)
672 weights[0] = np.reshape(weights[0], layer_weights_shape)
673 elif layer_weights_shape != weights[0].shape:
--> 674 weights[0] = np.transpose(weights[0], (3, 2, 0, 1))
675 if layer.__class__.__name__ == 'ConvLSTM2D':
676 weights[1] = np.transpose(weights[1], (3, 2, 0, 1))
path-to-numpy\numpy\core\fromnumeric.py in transpose(a, axes)
596
597 """
--> 598 return _wrapfunc(a, 'transpose', axes)
599
600
path-to-numpy\numpy\core\fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
49 def _wrapfunc(obj, method, *args, **kwds):
50 try:
---> 51 return getattr(obj, method)(*args, **kwds)
52
53 # An AttributeError occurs if the object does not have
ValueError: axes don't match array
Any help would be appreciated
from image-quality-assessment.
You are trying to initialize the original MobileNet architecture with weights from MobileNet Aesthetic. The architecture for MobileNet Aesthetic differs from the original one, hence you wonβt be able to use these weights.
Use the NIMA model class in src/handlers/model_builder.py to manually load the aesthetic weights.
from image-quality-assessment.
thanks for your response. However I am not able to figure out how to get a pretrained model from this repository. Can you provide the steps. It will be very helpful. Thanks.
from image-quality-assessment.
Related Issues (20)
- Failed to build docker file NIMA.cpu HOT 2
- How to save output of batch prediction?
- Error response from daemon:invalid volume specification HOT 1
- ./train-local: line 34: jq: command not found HOT 1
- Predict on CPU-limit memory usage
- How to label to train custom dataset HOT 1
- Hotel Rooms Dataset & Trained Model
- Setup
- No module named 'sklearn' HOT 1
- Max Entropy Result for value = 7 yields 5.5 in calc_mean_score
- exec entrypoints/entrypoint.predict.cpu.sh: no such file or directory HOT 1
- I'm getting "exec entrypoints/entrypoint.train.cpu.sh: no such file or directory" HOT 1
- predictions don't match?
- Thanks for the code!!
- Error while installing requirements.txt HOT 3
- Can the model reach the loss value and accuracy given in the paper? HOT 3
- How to increase accurancy for set from ~ 2k interior images?
- Create a REST/Kafka Consumer service for predict
- tensorflow 1.** HOT 1
- Image format and type HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image-quality-assessment.